[FIX] solve bugs from test 10

This commit is contained in:
Nossibaelhadi 2026-01-07 23:54:26 +03:00
parent 6d4f62c093
commit f80adeb9c5
5 changed files with 55 additions and 11 deletions

View File

@ -7526,46 +7526,66 @@ msgid "Reference number from the payment machine"
msgstr "رقم المرجع من ماكينة الدفع"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Bank and 4 Last Digits."
msgstr "يجب ادخال الينك و اخر اربعة ارقام"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Check Due Date."
msgstr "يجب إدخال تاريخ الإستحقاق"
msgstr "يجب ادخال تاريخ الاستحقاق"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Check Number."
msgstr "يجب إدخال رقم الشيك"
msgstr "يجب ادخال رقم الشيك"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter File Attached."
msgstr "يجب إدخال المستند"
msgstr "يجب ادخال المستند"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Machine."
msgstr "يجب إدخال الماكينة"
msgstr "يجب ادخال الماكينة"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Partner Bank ID."
msgstr "يجب إدخال بنك المتبرع/الكافل"
msgstr "يجب ادخال بنك المتبرع"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter Payment Method."
msgstr "يجل إدخال طريقة الدفع"
msgstr "يجب ادخال طريقة الدفع"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Please enter journal ID."
msgstr "يجب إدخال جساب الجمعية"
msgstr "يجب ادخال حساب الجمعية"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__bank_id
msgid "Bank"
msgstr "البنك"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__last_digits
msgid "Last Digits"
msgstr "اخر اربعة خانات"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__show_last_digits
msgid "Use 4 Digits"
msgstr "استخدام اخر اربعة خانات"

View File

@ -62,7 +62,7 @@ class TakafulSponsorship(models.Model):
gifter_message = fields.Text(string='Message To Gifter')
sponsorship_type = fields.Selection([('person', 'Individual'),('group', 'Group')],string='Sponsorship Type',tracking=True)
code = fields.Char(string="Sequence",copy=False,readonly=True)
code = fields.Char(string="Sequence",copy=False)
benefit_type = fields.Selection([('orphan', 'Orphans'),('widow', 'Widows')],string='Sponsorship Beneficiary Type',tracking=True)
branch_custom_id = fields.Many2one('branch.settings', string="Branch", default=lambda self: self._default_branch_custom_id(), required=True, tracking=True)
sponsorship_creation_date = fields.Datetime(string="Sponsorship Creation Date", default=fields.Datetime.now, required=True, copy=False)

View File

@ -174,6 +174,7 @@
<field name="is_donations_coordinator" invisible="1"/>
<field name="is_sponsorship_coordinator" invisible="1"/>
<field name="registered_type" invisible="1" attrs="{'readonly': [('state','!=','draft')]}"/>
<field name="code" invisible="1" attrs="{'readonly': True}"/>
<label string="Sponsor / Donor Type" for="sponsor_or_donor_type"/>
<div class="o_row">

View File

@ -91,6 +91,9 @@ class AccountRegisterPayment(models.TransientModel):
string="Show Payment Group",
compute="_compute_show_payment_group"
)
show_last_digits = fields.Boolean(string="Use 4 Digits",)
last_digits = fields.Integer(string="Last Digits")
bank_id = fields.Many2one('res.bank', string="Bank")
@api.depends('can_group_payments')
def _compute_show_payment_group(self):
@ -286,12 +289,18 @@ class AccountRegisterPayment(models.TransientModel):
method = self.takaful_payment_method_id.payment_method
if method in ('check', 'bank'):
if not self.partner_bank_id:
errors.append(_("Please enter Partner Bank ID."))
if not self.transaction_file_attachment:
errors.append(_("Please enter File Attached."))
if method == 'bank':
if self.show_last_digits:
if not self.last_digits or not self.bank_id and self.last_digits <= 0:
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."))
if method == 'check':
if not self.partner_bank_id:
errors.append(_("Please enter Partner Bank ID."))
if not self.check_number:
errors.append(_("Please enter Check Number."))
if not self.check_due_date:
@ -304,6 +313,7 @@ class AccountRegisterPayment(models.TransientModel):
if errors:
raise ValidationError("\n".join(errors))
self.communication += "******" + self.bank_id.name + "******" + str(self.last_digits)
res = super(AccountRegisterPayment,
self.with_context(skip_account_move_synchronization=True)).action_create_payments()

View File

@ -64,6 +64,10 @@
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
</xpath>
<xpath expr="//field[@name='payment_method_line_id']" position="attributes">
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
</xpath>
<xpath expr="//field[@name='branch_id']" position="attributes">
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
</xpath>
@ -99,10 +103,19 @@
<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), ('takaful_payment_method','not in',['bank','check'])]}" create="1" edit="1"/>
<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="last_digits"
attrs="{'invisible': [('show_last_digits', '=', False)]}"/>
<field name="bank_id"
attrs="{'invisible': [('show_last_digits', '=', False)]}"/>
<field name="transaction_file_attachment" widget="binary"
filename="transaction_attachment_file_name"
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])]}"/>
<field name="transaction_attachment_file_name" invisible="1"/>
<field name="payment_date" attrs="{'readonly': [('sponsorship_payment', '=', True)]}"/>
<field name="communication"/>