diff --git a/odex25_takaful/odex_takaful/i18n/ar_001.po b/odex25_takaful/odex_takaful/i18n/ar_001.po index dea3b5903..a20271d90 100644 --- a/odex25_takaful/odex_takaful/i18n/ar_001.po +++ b/odex25_takaful/odex_takaful/i18n/ar_001.po @@ -586,6 +586,12 @@ msgstr "كل الكفالات" msgid "Allowed Payments" msgstr "الدفعات المسموحة" +#. module: odex_takaful +#: model:ir.model.fields,field_description:odex_takaful.field_benefit_category__allowed_sponsorship +#: model:ir.model.fields,field_description:odex_takaful.field_family_member__allowed_sponsorship +msgid "Allowed Sponsorship" +msgstr "السماح للكفالة" + #. module: odex_takaful #: code:addons/odex_takaful/reports/month_payment_report.py:0 #: code:addons/odex_takaful/reports/month_payment_report.py:0 @@ -4481,6 +4487,11 @@ msgstr "شريك" msgid "Partner Bank" msgstr "بنك المتبرع" +#. module: odex_takaful +#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_history_form +msgid "Pay" +msgstr "سداد" + #. module: odex_takaful #: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form msgid "Pay All Sponsorships" diff --git a/odex25_takaful/odex_takaful/models/donation_extension_history.py b/odex25_takaful/odex_takaful/models/donation_extension_history.py index 239a7bcf5..658176791 100644 --- a/odex25_takaful/odex_takaful/models/donation_extension_history.py +++ b/odex25_takaful/odex_takaful/models/donation_extension_history.py @@ -161,3 +161,29 @@ class DonationExtensionHistory(models.Model): ) else: rec.extension_ref = _('Extension') + + def action_pay_invoice(self): + self.ensure_one() + + return { + 'name': _('Register Payment'), + 'res_model': 'account.payment.register', + 'view_mode': 'form', + 'context': { + 'active_model': 'account.move', + 'active_ids': self.invoice_id.ids, + 'default_amount': self.extension_amount, + 'sponsorship_payment_skip_compute_amount': True, + 'dont_redirect_to_payments': True, + 'sponsorship_line_ids': self.donation_detail_id.ids, + 'sponsorship_payment': True, + 'default_sponsorship_payment': True, + 'from_extension_history': True, + 'donation_extension_history_id': self.id, + 'sponsorship_id': self.sponsorship_id.id, + 'default_takaful_sponsorship_id': self.sponsorship_id.id, + 'force_sponsorship_line_partner_id': self.sponsor_id.id, + }, + 'target': 'new', + 'type': 'ir.actions.act_window', + } diff --git a/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml b/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml index 466d5efdc..0487d2c9b 100644 --- a/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml +++ b/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml @@ -29,8 +29,8 @@
- + +
diff --git a/odex25_takaful/odex_takaful/wizards/account_payment_register.py b/odex25_takaful/odex_takaful/wizards/account_payment_register.py index 68debfcd8..516a5dbe9 100644 --- a/odex25_takaful/odex_takaful/wizards/account_payment_register.py +++ b/odex25_takaful/odex_takaful/wizards/account_payment_register.py @@ -373,7 +373,13 @@ class AccountRegisterPayment(models.TransientModel): res = super(AccountRegisterPayment, self.with_context(skip_account_move_synchronization=True)).action_create_payments() - if self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'): + donation_extension_history_id = self.env.context.get('donation_extension_history_id') + if self.env.context.get('from_extension_history') and donation_extension_history_id and res: + history = self.env['donation.extension.history'].browse(donation_extension_history_id) + if history: + history.sudo().write({'state': 'paid'}) + + elif self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'): if self.amount < self.env.context.get('default_amount'): wiz = self.env['donation.extension.wizard'].browse(self.env.context.get('wiz_id')) wiz.paid_amount += self.amount