Merge pull request #6274 from expsa/fix_bugs

Fix bugs
This commit is contained in:
NossibaElhadi 2026-01-20 19:30:41 +03:00 committed by GitHub
commit f97b8b14a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 106 additions and 12 deletions

View File

@ -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',

View File

@ -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 "التمديد الشامل"

View File

@ -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

View File

@ -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'}
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
},
}

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Global Extension Wizard Form View -->
<record id="view_global_extension_wizard_form" model="ir.ui.view">
<field name="name">global.extension.wizard.form</field>
<field name="model">global.extension.wizard</field>
<field name="arch" type="xml">
<form string="Global Extension" create="false" edit="false">
<notebook>
<group string="Donation Lines">
<field name="line_ids"
options="{'no_create': True, 'no_create_edit': True}">
<tree string="Donation Lines" selectable="1">
<field name="sequence_no"/>
<field name="sponsor_id"/>
<field name="sponsor_phone"/>
<field name="state"/>
<field name="end_date"/>
<field name="donation_amount"/>
</tree>
</field>
</group>
</notebook>
<footer>
<button name="action_confirm"
string="Confirm"
type="object"
class="btn-primary"/>
<button string="Cancel"
special="cancel"
class="btn-secondary"/>
</footer>
</form>
</field>
</record>
</odoo>