diff --git a/odex25_ensan/odex_takaful/data/server_actions.xml b/odex25_ensan/odex_takaful/data/server_actions.xml
index c4bdf4c4c..ee01e5634 100644
--- a/odex25_ensan/odex_takaful/data/server_actions.xml
+++ b/odex25_ensan/odex_takaful/data/server_actions.xml
@@ -10,5 +10,13 @@
action = records.action_unlink_sponsor_and_related()
+
+
+ Extend Donation
+
+
+ code
+ action = records.action_extend_sponsorship()
+
\ No newline at end of file
diff --git a/odex25_ensan/odex_takaful/models/account_move.py b/odex25_ensan/odex_takaful/models/account_move.py
index b67c5434f..eaaebd7ec 100644
--- a/odex25_ensan/odex_takaful/models/account_move.py
+++ b/odex25_ensan/odex_takaful/models/account_move.py
@@ -7,13 +7,22 @@ from collections import defaultdict
class AccountMove(models.Model):
_inherit = 'account.move'
- takaful_sponsorship_id = fields.Many2one('takaful.sponsorship')
+ takaful_sponsorship_id = fields.Many2one('takaful.sponsorship', compute='_compute_takaful_sponsorship_id', store=True)
is_refund_sponsorship = fields.Boolean(string='Is Refund Sponsorship', default=False)
sponsorship_scheduling_line = fields.Many2one('sponsorship.scheduling.line')
payment_details_line = fields.Many2one('payment.details.lines')
sponsorship_id = fields.Many2one('takaful.sponsorship', string='Sponsorship', readonly=True, )
payment_id = fields.Many2one('account.payment', string='Payment', copy=False)
+ @api.depends('state')
+ def _compute_takaful_sponsorship_id(self):
+ for move in self:
+ if not move.takaful_sponsorship_id:
+ partials = move.line_ids.matched_debit_ids | move.line_ids.matched_credit_ids
+ takaful_sponsorship_ids = (partials.debit_move_id.move_id.takaful_sponsorship_id | partials.credit_move_id.move_id.takaful_sponsorship_id)
+ move.takaful_sponsorship_id = takaful_sponsorship_ids[-1] if takaful_sponsorship_ids else False
+ else:
+ move.takaful_sponsorship_id = move.takaful_sponsorship_id
def action_move_line_create(self):
'''
Confirm the vouchers given in ids and create the journal entries for each of them
@@ -239,5 +248,5 @@ class AccountMove(models.Model):
class AccountMoveLines(models.Model):
_inherit = 'account.move.line'
- takaful_sponsorship_id = fields.Many2one('takaful.sponsorship')
+ takaful_sponsorship_id = fields.Many2one('takaful.sponsorship', related='move_id.takaful_sponsorship_id', store=True)
diff --git a/odex25_ensan/odex_takaful/models/donation_details_lines.py b/odex25_ensan/odex_takaful/models/donation_details_lines.py
index a44af72f0..b6145bfe9 100644
--- a/odex25_ensan/odex_takaful/models/donation_details_lines.py
+++ b/odex25_ensan/odex_takaful/models/donation_details_lines.py
@@ -934,7 +934,6 @@ class DonationsDetailsLines(models.Model):
"""
Open wizard to extend donation detail line
"""
- self.ensure_one()
return {
'type': 'ir.actions.act_window',
@@ -943,9 +942,7 @@ class DonationsDetailsLines(models.Model):
'view_mode': 'form',
'target': 'new',
'context': {
- 'default_donation_detail_id': self.id,
- 'default_current_end_date': self.end_date,
- 'default_amount': self.product_template_id.list_price,
+ 'donation_detail_ids': self.ids,
},
}
diff --git a/odex25_ensan/odex_takaful/models/res_partner.py b/odex25_ensan/odex_takaful/models/res_partner.py
index 4390bf9cd..8c54daa2e 100644
--- a/odex25_ensan/odex_takaful/models/res_partner.py
+++ b/odex25_ensan/odex_takaful/models/res_partner.py
@@ -5,8 +5,7 @@ from odoo.exceptions import UserError, ValidationError, Warning
from dateutil.parser import parse
import re
from odoo.osv import expression
-SAUDI_MOBILE_PATTERN = r"^(05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$"
-
+SAUDI_MOBILE_PATTERN = r"^(\+?966)?0?5[013456789][0-9]{7}$"
class IrActionsServer(models.Model):
_inherit = 'ir.actions.server'
@@ -407,3 +406,15 @@ class ResPartner(models.Model):
else:
rec.name = " "
+class ResPartnerBank(models.Model):
+ _inherit = 'res.partner.bank'
+
+ def name_get(self):
+ result = []
+ for bank in self:
+ if bank.bank_id:
+ name = f"{bank.acc_number} - {bank.bank_id.name}"
+ else:
+ name = f"{bank.acc_number}"
+ result.append((bank.id, name))
+ return result
\ No newline at end of file
diff --git a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py
index 63336a5a3..6b0724671 100644
--- a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py
+++ b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py
@@ -15,7 +15,7 @@ import requests
from odoo.osv import expression
import logging
-SAUDI_MOBILE_PATTERN = r"^(05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$"
+SAUDI_MOBILE_PATTERN = r"^(\+?966)?0?5[013456789][0-9]{7}$"
def trunc_datetime(someDate):
@@ -755,6 +755,7 @@ class TakafulSponsorship(models.Model):
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
line.tax_ids = taxes
line.product_uom_id = line._get_computed_uom()
+ bill_id.action_post()
else:
sponsorship.state = sponsorship.state
@@ -1068,90 +1069,11 @@ class TakafulSponsorship(models.Model):
rec.expected_cancel_date = None
rec.due_days = 0
- # On Change
- # @api.onchange('sponsorship_class', 'sponsorship_type', 'benefit_id', 'benefit_ids')
- # def sponsorship_fully_value(self):
- # if self.sponsorship_class == 'fully' and self.benefit_ids and self.sponsorship_type == 'group':
- # self.update({'contribution_value': sum(
- # self.benefit_ids.mapped('benefit_needs_value'))})
- # elif self.sponsorship_class == 'fully' and self.benefit_id and self.sponsorship_type == 'person':
- # self.update(
- # {'contribution_value': self.benefit_id.benefit_needs_value})
- # else:
- # self.update({'contribution_value': 0})
-
- # @api.constrains('contribution_value')
- # def check_contribution_value(self):
- # if not self.sponsor_id:
- # raise ValidationError(
- # _(u'Please Select The Sponsor'))
-
- # if not self.sponsorship_type:
- # raise ValidationError(
- # _(u'Please Select Sponsorship Type'))
- #
- # if not self.benefit_type:
- # raise ValidationError(
- # _(u'Please Select Sponsorship Beneficiary Type'))
- #
- # if not self.sponsorship_class:
- # raise ValidationError(
- # _(u'Please Select Sponsorship Class'))
- #
- # if not self.sponsorship_duration:
- # raise ValidationError(
- # _(u'Please Select Sponsorship Duration'))
- #
- # if not self.benefit_id and self.sponsorship_type == 'person':
- # raise ValidationError(
- # _(u'Please Select a Beneficiary For Sponsorship Person'))
- #
- # if len(self.benefit_ids) < 2 and self.sponsorship_type == 'group':
- # raise ValidationError(
- # _(u'Please Select At least Two Beneficiaries For Sponsorship Group'))
- #
- # if self.sponsorship_class == 'partial':
- # default_sponsorship = int(
- # self.env['ir.config_parameter'].sudo().get_param('odex_takaful_base.min_kafala', 0))
- #
- # if self.benefit_ids and self.sponsorship_type == 'group':
- # benefit_count = len(self.benefit_ids)
- # else:
- # benefit_count = 1
- #
- # if default_sponsorship <= 0:
- # raise ValidationError(
- # _(u'Min kafala value should be defined by administration'))
- #
- # total_sponsorship = default_sponsorship * benefit_count
- # if self.contribution_value < total_sponsorship:
- # raise ValidationError(
- # _(u'Kafala value should be equal or greater than') + ' ' + str(total_sponsorship))
-
- # Model Operations
@api.model
def create(self, vals):
if vals.get('code', 'New') == 'New':
vals['code'] = self.env['ir.sequence'].sudo().next_by_code('sponsorship.sequence')
- # if vals.get('benefit_type') == 'orphan':
- # main_code = self.env['ir.sequence'].sudo(
- # ).next_by_code('sponsorship.sequence')
- # sub_code = self.env['ir.sequence'].sudo().next_by_code(
- # 'sponsorship.orphan.sequence')
- # if main_code and sub_code:
- # defualt_code = 'OR/' + str(main_code) + '/' + sub_code
- # vals.update({"code": defualt_code})
-
- # elif vals.get('benefit_type') == 'widow':
- # main_code = self.env['ir.sequence'].sudo(
- # ).next_by_code('sponsorship.sequence')
- # sub_code = self.env['ir.sequence'].sudo().next_by_code(
- # 'sponsorship.widow.sequence')
- # if main_code and sub_code:
- # defualt_code = 'WI/' + str(main_code) + '/' + sub_code
- # vals.update({"code": defualt_code})
-
- # Valid Sponsor Mobile
+
sponsor_phone = vals.get('sponsor_phone', False)
if sponsor_phone:
self._check_phone_numbers(sponsor_phone)
@@ -1730,6 +1652,7 @@ class TakafulSponsorship(models.Model):
'dont_redirect_to_payments': True,
'sponsorship_line_ids': sponsorship_line_ids.ids,
'sponsorship_payment': True,
+ 'sponsorship_payment_skip_compute_amount': True,
'default_sponsorship_payment': True,
'force_sponsorship_line_partner_id': self.sponsor_id.id,
},
@@ -1743,6 +1666,15 @@ class TakafulSponsorship(models.Model):
sponsorship_line_ids = (rec.donations_details_lines | rec.donations_details_lines_mechanism_ids).filtered(lambda l: not l.direct_debit)
rec.show_register_payment = rec.with_context(exclude_direct_debit=True).amount_paid < sum(sponsorship_line_ids.mapped('total_donation_amount'))
+ def action_reset_to_draft(self):
+ for rec in self:
+ if rec.state != 'confirmed':
+ raise ValidationError(_("You can only reset to draft a confirmed sponsorship."))
+ move_ids = rec.journal_entry_ids.filtered(lambda l: l.move_type == 'out_invoice')
+ move_ids.button_draft()
+ move_ids.button_cancel()
+ self.write({'state': 'draft'})
+
class AnotherSponsors(models.Model):
_name = "donate.for.another.person"
diff --git a/odex25_ensan/odex_takaful/security/ir.model.access.csv b/odex25_ensan/odex_takaful/security/ir.model.access.csv
index 25899b728..7c34b0b99 100644
--- a/odex25_ensan/odex_takaful/security/ir.model.access.csv
+++ b/odex25_ensan/odex_takaful/security/ir.model.access.csv
@@ -45,6 +45,7 @@ access_group_kufula_user_account_partial_reconcile,access_group_kufula_user_acco
access_group_kufula_user_account_full_reconcile,access_group_kufula_user_account_full_reconcile,account.model_account_full_reconcile,odex_takaful.group_kufula_user,1,1,1,0
access_donation_extension_wizard,donation.extension.wizard.access,model_donation_extension_wizard,base.group_user,1,1,1,1
access_donation_extension_history,donation.extension.history.access,model_donation_extension_history,odex_takaful.group_kufula_user,1,1,1,0
+access_donation_extension_wizard_line,donation.extension.wizard.line.access,model_donation_extension_wizard_line,odex_takaful.group_kufula_user,1,1,1,0
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,odex_takaful.group_replace_sponsor,1,1,1,1
diff --git a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml
index b5ddf7845..d13a75436 100644
--- a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml
+++ b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml
@@ -39,6 +39,9 @@
+
@@ -181,7 +184,7 @@
diff --git a/odex25_ensan/odex_takaful/wizards/account_payment_register.py b/odex25_ensan/odex_takaful/wizards/account_payment_register.py
index 5815dc491..f04d0698c 100644
--- a/odex25_ensan/odex_takaful/wizards/account_payment_register.py
+++ b/odex25_ensan/odex_takaful/wizards/account_payment_register.py
@@ -43,7 +43,7 @@ class AccountRegisterPayment(models.TransientModel):
@api.depends('source_amount', 'source_amount_currency', 'source_currency_id', 'company_id', 'currency_id', 'payment_date')
def _compute_amount(self):
- if self.env.context.get('sponsorship_payment'):
+ if self.env.context.get('sponsorship_payment_skip_compute_amount'):
self.amount = self.amount
else:
super(AccountRegisterPayment, self)._compute_amount()
@@ -65,7 +65,6 @@ class AccountRegisterPayment(models.TransientModel):
payments = super(AccountRegisterPayment, self)._create_payments()
if sponsorship_lines:
- sponsorship = sponsorship_lines.sponsorship_id or sponsorship_lines.sponsorship_mechanism_id
for line in sponsorship_lines:
state = ''
@@ -119,6 +118,7 @@ class AccountRegisterPayment(models.TransientModel):
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
line.tax_ids = taxes
line.product_uom_id = line._get_computed_uom()
+ bill_id.action_post()
for line in sponsorship_lines:
if line.record_type != 'sponsorship':
continue
@@ -138,7 +138,6 @@ class AccountRegisterPayment(models.TransientModel):
if self.env.context.get('is_direct_debit'):
payments.write({'direct_debit': True})
- payments.move_id.write({'takaful_sponsorship_id': sponsorship.id})
if self.transaction_file_attachment:
self.env['ir.attachment'].sudo().create({
diff --git a/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.py b/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.py
index 926560e32..87093ea7f 100644
--- a/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.py
+++ b/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.py
@@ -10,29 +10,15 @@ class DonationExtensionWizard(models.TransientModel):
_name = 'donation.extension.wizard'
_description = "Donation Extension Wizard"
- donation_detail_id = fields.Many2one(
- 'donations.details.lines',
- string='Donation Detail',
+ line_ids = fields.One2many(
+ 'donation.extension.wizard.line',
+ 'wizard_id',
+ string='Lines',
required=True,
- readonly=True
+ default=lambda self: self._compute_line_ids(),
)
- amount = fields.Float(
- string='Monthly Extension Amount',
- required=True,
- help='Amount per month for the extension period'
- )
- fixed_value = fields.Boolean(
- string='Is Fixed Value?',
- related='donation_detail_id.product_template_id.fixed_value'
- )
- total_months_amount = fields.Float(
- string='Total Months Amount',
- compute='_compute_total_months_amount',
- store=True,
- readonly=True,
- help='Total amount for the extension period'
- )
+ direct_debit = fields.Boolean(string='Direct Debit', required=True)
months = fields.Integer(
string='Extension Months',
@@ -40,6 +26,97 @@ class DonationExtensionWizard(models.TransientModel):
default=1,
help='Number of months to extend'
)
+
+ def _compute_line_ids(self):
+ extension_line_ids = [(5,)]
+ donation_detail_ids = self.env['donations.details.lines'].browse(self.env.context.get('donation_detail_ids'))
+ for line in donation_detail_ids:
+ if not (line.record_type == 'donation' and line.direct_debit) and line.record_type != 'sponsorship':
+ raise ValidationError(_("Only donation with direct debit or sponsorship can be extended. Line: %s") % line.name)
+ if line.end_date and line.end_date < fields.Date.context_today(line):
+ raise ValidationError(_("Only active donations with end date in the future can be extended. Line: %s") % line.name)
+ if line.state != 'active':
+ raise ValidationError(_("Only active donations can be extended. Line: %s") % line.name)
+ extension_line_ids.append((0, 0, {
+ 'donation_line_id': line.id,
+ 'current_end_date': line.end_date,
+ }))
+ return extension_line_ids
+
+ @api.constrains('months')
+ def _check_months(self):
+ for rec in self:
+ if rec.months <= 0:
+ raise ValidationError(_("Extension months must be greater than 0."))
+
+ @api.onchange('direct_debit')
+ def _onchange_direct_debit(self):
+ self.line_ids.direct_debit = self.direct_debit
+
+ def action_extend(self):
+ """
+ Extend the donation detail line with new amount and months
+ """
+ invoice_ids = self.env['account.move']
+ donation_line_ids = self.env['donations.details.lines']
+ for line in self.line_ids:
+ result = line._extend()
+ if result:
+ invoice_ids += result[0]
+ donation_line_ids += result[1]
+
+ if invoice_ids:
+ return {
+ 'name': _('Register Payment'),
+ 'res_model': 'account.payment.register',
+ 'view_mode': 'form',
+ 'context': {
+ 'active_model': 'account.move',
+ 'active_ids': invoice_ids.ids,
+ 'dont_redirect_to_payments': True,
+ 'sponsorship_line_ids': donation_line_ids.ids,
+ 'sponsorship_payment': True,
+ 'default_sponsorship_payment': True,
+ },
+ 'target': 'new',
+ 'type': 'ir.actions.act_window',
+ }
+
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': {
+ 'title': _('Success'),
+ 'message': _('Donation has been extended for %s month(s).') % (
+ self.months,
+ ),
+ 'type': 'success',
+ 'sticky': False,
+ 'next': {'type': 'ir.actions.act_window_close'}
+ }
+ }
+
+ def action_cancel(self):
+ """
+ Cancel the wizard
+ """
+ return {'type': 'ir.actions.act_window_close'}
+
+class DonationExtensionWizardLine(models.TransientModel):
+ _name = 'donation.extension.wizard.line'
+ _description = "Donation Extension Wizard Line"
+
+ wizard_id = fields.Many2one('donation.extension.wizard', string='Wizard', required=True)
+ donation_line_id = fields.Many2one('donations.details.lines', string='Donation Detail', required=True, readonly=True)
+ donation_qty = fields.Float(compute='_compute_donation_qty', store=True)
+ direct_debit = fields.Boolean()
+ total_months_amount = fields.Float(
+ string='Total Months Amount',
+ compute='_compute_total_months_amount',
+ store=True,
+ readonly=True,
+ help='Total amount for the extension period'
+ )
total_donation_amount = fields.Float(
string='Total Extension Amount',
@@ -60,20 +137,31 @@ class DonationExtensionWizard(models.TransientModel):
readonly=True
)
- direct_debit = fields.Boolean(string='Direct Debit', required=True)
+ # related
+ record_type = fields.Selection(related='donation_line_id.record_type')
+ sponsorship_type = fields.Selection(related='donation_line_id.sponsorship_type')
+ donation_amount = fields.Float(related='donation_line_id.donation_amount', store=True)
+ benefits_count = fields.Integer(related='donation_line_id.benefits_count')
+ sponsorship_id = fields.Many2one(related='donation_line_id.sponsorship_id')
+ fixed_value = fields.Boolean(related='donation_line_id.fixed_value')
+ donation_mechanism = fields.Selection(related='donation_line_id.donation_mechanism')
+ months = fields.Integer(related='wizard_id.months')
- @api.depends('amount', 'months')
+ @api.depends('benefits_count', 'donation_amount', 'months', 'donation_qty', 'record_type', 'sponsorship_type')
def _compute_total_donation_amount(self):
for rec in self:
- if rec.donation_detail_id.sponsorship_type == 'group':
- rec.total_donation_amount = rec.donation_detail_id.benefits_count * rec.total_months_amount
- else :
- rec.total_donation_amount = rec.total_months_amount
+ if rec.record_type == 'donation':
+ if rec.sponsorship_id.donation_mechanism == 'without_conditions':
+ rec.total_donation_amount = rec.donation_amount * rec.donation_qty
+ else:
+ rec.total_donation_amount = rec.total_months_amount
+ else:
+ rec.total_donation_amount = rec.total_months_amount * rec.benefits_count
- @api.depends('amount', 'months')
+ @api.depends('donation_amount', 'months')
def _compute_total_months_amount(self):
for rec in self:
- rec.total_months_amount = rec.amount * rec.months
+ rec.total_months_amount = rec.donation_amount * rec.months
@api.depends('current_end_date', 'months')
def _compute_new_end_date(self):
@@ -83,25 +171,15 @@ class DonationExtensionWizard(models.TransientModel):
else:
rec.new_end_date = False
- @api.constrains('months')
- def _check_months(self):
+ @api.depends('donation_line_id')
+ def _compute_donation_qty(self):
for rec in self:
- if rec.months <= 0:
- raise ValidationError(_("Extension months must be greater than 0."))
-
- @api.constrains('amount')
- def _check_amount(self):
- for rec in self:
- if rec.amount <= 0:
- raise ValidationError(_("Extension amount must be greater than 0."))
-
- def action_extend(self):
- """
- Extend the donation detail line with new amount and months
- """
+ rec.donation_qty = rec.donation_line_id.donation_qty
+
+ def _extend(self):
self.ensure_one()
- if not self.donation_detail_id:
+ if not self.donation_line_id:
raise ValidationError(_("No donation detail line selected."))
# Update the donation detail line
@@ -109,14 +187,14 @@ class DonationExtensionWizard(models.TransientModel):
old_end_date = self.current_end_date
# Update end date
- self.donation_detail_id.write({
+ self.donation_line_id.write({
'end_date': new_end_date,
'donation_amount': self.total_months_amount,
- 'payment_month_count': self.donation_detail_id.payment_month_count + self.months,
+ 'payment_month_count': self.donation_line_id.payment_month_count + self.months,
# 'state': 'extended',
})
- benefit_ids = self.donation_detail_id.benefit_ids | self.donation_detail_id.benefit_id
+ benefit_ids = self.donation_line_id.benefit_ids | self.donation_line_id.benefit_id
benefit_ids.write({
'sponsorship_end_date': new_end_date,
})
@@ -130,52 +208,23 @@ class DonationExtensionWizard(models.TransientModel):
# Create extension history record
self.env['donation.extension.history'].create({
- 'donation_detail_id': self.donation_detail_id.id,
- 'sponsorship_id': self.donation_detail_id.sponsorship_id.id or self.donation_detail_id.sponsorship_mechanism_id.id,
+ 'donation_detail_id': self.donation_line_id.id,
+ 'sponsorship_id': self.donation_line_id.sponsorship_id.id or self.donation_line_id.sponsorship_mechanism_id.id,
'extension_amount': self.total_donation_amount,
'extension_months': self.months,
'old_end_date': old_end_date,
'new_end_date': new_end_date,
'invoice_id': invoice_id.id if invoice_id else False,
- 'old_direct_debit': self.donation_detail_id.direct_debit,
+ 'old_direct_debit': self.donation_line_id.direct_debit,
'new_direct_debit': self.direct_debit,
})
if not self.direct_debit:
- result = {
- 'name': _('Register Payment'),
- 'res_model': 'account.payment.register',
- 'view_mode': 'form',
- 'context': {
- 'active_model': 'account.move',
- 'active_ids': invoice_id.ids,
- 'default_amount': self.total_donation_amount,
- 'dont_redirect_to_payments': True,
- 'sponsorship_line_ids': self.donation_detail_id.ids,
- 'sponsorship_payment': True,
- 'default_sponsorship_payment': True,
- 'force_sponsorship_line_partner_id': self.donation_detail_id.sponsor_id.id,
- },
- 'target': 'new',
- 'type': 'ir.actions.act_window',
- }
- else:
- result = {
- 'type': 'ir.actions.client',
- 'tag': 'display_notification',
- 'params': {
- 'title': _('Success'),
- 'message': _('Donation has been extended for %s month(s) until %s') % (
- self.months,
- new_end_date.strftime('%Y-%m-%d')
- ),
- 'type': 'success',
- 'sticky': False,
- 'next': {'type': 'ir.actions.act_window_close'}
- }
- }
+ return invoice_id, self.donation_line_id
+
- return result
+ return False
+
def _create_extension_scheduling_lines(self):
"""
@@ -183,7 +232,7 @@ class DonationExtensionWizard(models.TransientModel):
"""
self.ensure_one()
- donation_line = self.donation_detail_id
+ donation_line = self.donation_line_id
start_date = self.current_end_date + relativedelta(months=1)
# Distribute total amount across months
@@ -214,7 +263,7 @@ class DonationExtensionWizard(models.TransientModel):
"""
self.ensure_one()
- donation_line = self.donation_detail_id
+ donation_line = self.donation_line_id
sponsorship = donation_line.sponsorship_id or donation_line.sponsorship_mechanism_id
# Get journal from settings
@@ -258,10 +307,4 @@ class DonationExtensionWizard(models.TransientModel):
invoice_id.action_post()
return invoice_id
-
- def action_cancel(self):
- """
- Cancel the wizard
- """
- return {'type': 'ir.actions.act_window_close'}
-
+
\ No newline at end of file
diff --git a/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.xml b/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.xml
index 97b22bcf7..e49c14a2e 100644
--- a/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.xml
+++ b/odex25_ensan/odex_takaful/wizards/donation_extension_wizard.xml
@@ -7,21 +7,37 @@