Merge pull request #6074 from expsa/fix_bugs

Fix bugs
This commit is contained in:
NossibaElhadi 2026-01-08 14:54:26 +03:00 committed by GitHub
commit dda8b41781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 8 deletions

View File

@ -7583,9 +7583,17 @@ msgstr "البنك"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__last_digits
msgid "Last Digits"
msgstr "اخر اربعة خانات"
msgstr "رقم الحساب"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__show_last_digits
msgid "Use 4 Digits"
msgstr "استخدام اخر اربعة خانات"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_account_payment_register_form
msgid "You Can Type 4 Digits"
msgstr "يمكنك كتابة اربعة خانات"

View File

@ -92,7 +92,7 @@ class AccountRegisterPayment(models.TransientModel):
compute="_compute_show_payment_group"
)
show_last_digits = fields.Boolean(string="Use 4 Digits",)
last_digits = fields.Integer(string="Last Digits")
last_digits = fields.Char(string="Last Digits", size=32)
bank_id = fields.Many2one('res.bank', string="Bank")
@api.depends('can_group_payments')
@ -115,6 +115,14 @@ class AccountRegisterPayment(models.TransientModel):
if rec.machine_id:
rec.journal_id = rec.machine_id.journal_id
@api.onchange("partner_bank_id")
def onchange_partner_bank_id(self):
for rec in self:
if rec.partner_bank_id:
rec.show_last_digits = False
else:
rec.show_last_digits = True
@api.onchange("takaful_payment_method_id")
def onchange_takaful_payment_method_id(self):
for rec in self:
@ -294,7 +302,7 @@ class AccountRegisterPayment(models.TransientModel):
if method == 'bank':
if self.show_last_digits:
if not self.last_digits or not self.bank_id and self.last_digits <= 0:
if not self.last_digits or not self.bank_id:
errors.append(_("Please enter Bank and 4 Last Digits."))
elif not self.show_last_digits and not self.partner_bank_id:
errors.append(_("Please enter Partner Bank ID."))

View File

@ -103,12 +103,11 @@
<field name="payment_method" invisible="1"/>
<field name="check_number" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')]}"/>
<field name="check_due_date" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')]}"/>
<field name="partner_bank_id" string="Donor Bank Account" options="{'skip_disable_quick_create': True}" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}" attrs="{'invisible': ['|', '|', ('sponsorship_payment', '=', False), ('show_last_digits', '=', True), ('takaful_payment_method','not in',['bank','check'])]}" create="1" edit="1"/>
<field name="show_last_digits"
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','bank')]}"/>
<field name="partner_bank_id" string="Donor Bank Account" options="{'skip_disable_quick_create': True}" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}" attrs="{'invisible': ['|',('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank','check'])]}" create="1" edit="1"/>
<field name="show_last_digits" invisible="1"/>
<field name="last_digits"
attrs="{'invisible': [('show_last_digits', '=', False)]}"/>
attrs="{'invisible': [('show_last_digits', '=', False)]}" placeholder="You Can Type 4 Digits"/>
<field name="bank_id"
attrs="{'invisible': [('show_last_digits', '=', False)]}"/>

View File

@ -131,7 +131,7 @@ class DonationExtensionWizard(models.TransientModel):
'default_sponsorship_payment': True,
'wiz_id': self.id,
'sponsorship_id': sponsorship_id,
# 'force_sponsorship_line_partner_id': self.donation_detail_id.sponsor_id.id,
'force_sponsorship_line_partner_id': self.line_ids.mapped('partner_id')[:1].id,
},
'target': 'new',
'type': 'ir.actions.act_window',