From ef52dd6c86ab48b6f39993a928d73aa34b5c550e Mon Sep 17 00:00:00 2001 From: Nossibaelhadi Date: Tue, 20 Jan 2026 19:25:15 +0300 Subject: [PATCH] [FIX] solve bugs from test 18 --- odex25_takaful/odex_takaful/__manifest__.py | 1 + odex25_takaful/odex_takaful/i18n/ar_001.po | 36 ++++++++++++++++ .../wizards/account_payment_register.py | 3 +- .../wizards/global_extension_wizard.py | 35 ++++++++++----- .../wizards/global_extension_wizard.xml | 43 +++++++++++++++++++ 5 files changed, 106 insertions(+), 12 deletions(-) create mode 100644 odex25_takaful/odex_takaful/wizards/global_extension_wizard.xml diff --git a/odex25_takaful/odex_takaful/__manifest__.py b/odex25_takaful/odex_takaful/__manifest__.py index 19e9ee2c4..0970a8719 100644 --- a/odex25_takaful/odex_takaful/__manifest__.py +++ b/odex25_takaful/odex_takaful/__manifest__.py @@ -87,6 +87,7 @@ 'views/global_extension_wizard_view.xml', 'views/takaful_menus_actions.xml', 'views/benefit_category_views.xml', + 'wizards/global_extension_wizard.xml', 'data/message_template_data.xml', 'wizards/transfer_deduction_wizard_views.xml', diff --git a/odex25_takaful/odex_takaful/i18n/ar_001.po b/odex25_takaful/odex_takaful/i18n/ar_001.po index aa87750a2..5527b705b 100644 --- a/odex25_takaful/odex_takaful/i18n/ar_001.po +++ b/odex25_takaful/odex_takaful/i18n/ar_001.po @@ -7543,3 +7543,39 @@ msgstr "طريقة السداد (بالاسم)" #: model:ir.model.fields,field_description:odex_takaful.field_account_payment__payment_method_name msgid "Payment Method Name" msgstr "اسم طريقة السداد" + +#. module: odex_takaful +#: model:ir.model.fields,field_description:odex_takaful.field_global_extension_wizard__number_of_months +msgid "Number of Months" +msgstr "أشهر التمديد" + +#. module: odex_takaful +#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form +msgid "Cancel" +msgstr "إلغاء" + + +#. module: odex_takaful +#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form +msgid "Confirm" +msgstr "تاكيد" + +#. module: odex_takaful +#: model:ir.model.fields,field_description:odex_takaful.field_global_extension_wizard__line_ids +#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form +msgid "Donation Lines" +msgstr "الكفالات" + +#. module: odex_takaful +#: code:addons/odex_takaful/wizards/global_extension_wizard.py:0 +#, python-format +msgid "Extend Donation" +msgstr "تمديد الكفالة" + +#. module: odex_takaful +#: model:ir.actions.act_window,name:odex_takaful.action_global_extension_wizard +#: model:ir.ui.menu,name:odex_takaful.menu_global_extension_wizard +#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form +msgid "Global Extension" +msgstr "التمديد الشامل" + diff --git a/odex25_takaful/odex_takaful/wizards/account_payment_register.py b/odex25_takaful/odex_takaful/wizards/account_payment_register.py index 5fea90ff0..59748b28f 100644 --- a/odex25_takaful/odex_takaful/wizards/account_payment_register.py +++ b/odex25_takaful/odex_takaful/wizards/account_payment_register.py @@ -109,7 +109,8 @@ class AccountRegisterPayment(models.TransientModel): """Override to always group payments for sponsorship - simpler UX""" for wizard in self: # Always group payments when in sponsorship context - if self.env.context.get('sponsorship_payment'): + # if self.env.context.get('sponsorship_payment'): + if self.env.context.get('sponsorship_payment') and self.show_payment_group: wizard.group_payment = True else: # Fall back to default Odoo behavior diff --git a/odex25_takaful/odex_takaful/wizards/global_extension_wizard.py b/odex25_takaful/odex_takaful/wizards/global_extension_wizard.py index cb9f3463b..72f3bd81e 100644 --- a/odex25_takaful/odex_takaful/wizards/global_extension_wizard.py +++ b/odex25_takaful/odex_takaful/wizards/global_extension_wizard.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from odoo import models, fields, api +from odoo import models, fields, api, _ class GlobalExtensionWizard(models.TransientModel): @@ -17,17 +17,30 @@ class GlobalExtensionWizard(models.TransientModel): # Assumes the target model is 'donations.details.lines' as specified line_ids = fields.Many2many( comodel_name='donations.details.lines', - string='Donation Lines' + string='Donation Lines', + domain=[] ) + @api.onchange('line_ids') + def _onchange_line_ids_domain(self): + allowed_ids = self.env['donations.details.lines'].sudo().search([ + ('record_type', '=', 'sponsorship'), + ('sponsorship_duration', '=', 'temporary'), + ('state', 'in', ['active', 'replace']) + ]).ids + return {'domain': {'line_ids': [('id', 'in', allowed_ids)]}} + def action_confirm(self): - """ - Empty method for the Confirm action. - You will implement the logic here. - """ - # Example logic access: - # for wizard in self: - # selected_lines = wizard.line_ids - # months = wizard.number_of_months - return {'type': 'ir.actions.act_window_close'} \ No newline at end of file + return { + 'type': 'ir.actions.act_window', + 'name': _('Extend Donation'), + 'res_model': 'donation.extension.wizard', + 'view_mode': 'form', + 'target': 'new', + 'context': { + 'donation_detail_ids': self.line_ids.ids, + 'default_months': self.number_of_months, + 'no_quick_close': True + }, + } \ No newline at end of file diff --git a/odex25_takaful/odex_takaful/wizards/global_extension_wizard.xml b/odex25_takaful/odex_takaful/wizards/global_extension_wizard.xml new file mode 100644 index 000000000..8fecc6c13 --- /dev/null +++ b/odex25_takaful/odex_takaful/wizards/global_extension_wizard.xml @@ -0,0 +1,43 @@ + + + + + + global.extension.wizard.form + global.extension.wizard + +
+ + + + + + + + + + + + + + + + + + + +
+
+
+ +