[FIX] solve bugs from test5

This commit is contained in:
Nossibaelhadi 2026-01-05 11:22:59 +03:00
parent 9559a34382
commit b2767d2ba4
6 changed files with 43 additions and 10 deletions

View File

@ -7657,4 +7657,12 @@ msgstr "مساهمة مالية بالأمر %s"
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__paid #: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__paid
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search #: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
msgid "Paid" msgid "Paid"
msgstr "تم الدفع" msgstr "تم الدفع"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_journal__branch_ids
msgid "Branchs"
msgstr "الفروع المسموح بها"

View File

@ -10,3 +10,8 @@ class AccountPayment(models.Model):
confirm_payment_refund_image = fields.Binary() confirm_payment_refund_image = fields.Binary()
payment_method_line_id_type = fields.Selection(related = 'journal_id.type') payment_method_line_id_type = fields.Selection(related = 'journal_id.type')
class AccountPayment(models.Model):
_inherit = 'account.journal'
branch_ids = fields.Many2many('branch.settings', string="Branchs")

View File

@ -94,13 +94,14 @@ class FamilyMember(models.Model):
@api.depends('member_education_status_ids', 'education_status', 'member_education_status_ids.case_study') @api.depends('member_education_status_ids', 'education_status', 'member_education_status_ids.case_study')
def _compute_education_levels(self): def _compute_education_levels(self):
for record in self: for record in self:
record.education_levels = ( record.education_levels = False
record.member_education_status_ids.search( if record.education_status == 'educated':
[('case_study', '=', 'continuous')], rec = record.member_education_status_ids.filtered(
order='create_date desc', lambda r: r.case_study == 'continuous'
limit=1 ).sorted(
).education_levels if record.education_status == 'educated' else False) lambda r: r.create_date, reverse=True
)[:1]
record.education_levels = rec.education_levels if rec else False
@api.depends('sponsor_related_id') @api.depends('sponsor_related_id')
def _compute_kafala_status(self): def _compute_kafala_status(self):

View File

@ -32,4 +32,19 @@
</xpath> </xpath>
</field> </field>
</record> </record>
<!-- add branch for journal account-->
<record id="view_account_journal_form_inherit_custom" model="ir.ui.view">
<field name="name">account.journal.form.inherit.custom</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='account_control_ids']" position="after">
<field name="branch_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>
</odoo> </odoo>

View File

@ -68,6 +68,8 @@ class AccountRegisterPayment(models.TransientModel):
def onchange_takaful_payment_method_id(self): def onchange_takaful_payment_method_id(self):
for rec in self: for rec in self:
if rec.takaful_payment_method_id and rec.takaful_payment_method_id.journal_id: if rec.takaful_payment_method_id and rec.takaful_payment_method_id.journal_id:
sponsorships = self.env['takaful.sponsorship'].browse(self.env.context.get('sponsorship_id'))
branch_ids = sponsorships.mapped('branch_custom_id.id')
rec.journal_id = rec.takaful_payment_method_id.journal_id.id rec.journal_id = rec.takaful_payment_method_id.journal_id.id
payment_method = rec.takaful_payment_method_id.payment_method payment_method = rec.takaful_payment_method_id.payment_method
j_type = "" j_type = ""
@ -76,7 +78,7 @@ class AccountRegisterPayment(models.TransientModel):
elif payment_method in ("bank", "check","network"): elif payment_method in ("bank", "check","network"):
j_type = "bank" j_type = "bank"
if j_type: if j_type:
return {"domain": {"journal_id": [("type", "=", j_type)]}} return {"domain": {"journal_id": [("type", "=", j_type), ("branch_ids", "in", branch_ids)]}}
@api.depends('source_amount', 'source_amount_currency', 'source_currency_id', 'company_id', 'currency_id', 'payment_date') @api.depends('source_amount', 'source_amount_currency', 'source_currency_id', 'company_id', 'currency_id', 'payment_date')

View File

@ -115,6 +115,7 @@ class DonationExtensionWizard(models.TransientModel):
donation_line_ids += result[1] donation_line_ids += result[1]
if invoice_ids: if invoice_ids:
sponsorship_id = self.line_ids.mapped('donation_line_id.sponsorship_mechanism_id.id')
return { return {
'name': _('Register Payment'), 'name': _('Register Payment'),
'res_model': 'account.payment.register', 'res_model': 'account.payment.register',
@ -128,7 +129,8 @@ class DonationExtensionWizard(models.TransientModel):
'sponsorship_line_ids': self.line_ids.donation_line_id.ids, 'sponsorship_line_ids': self.line_ids.donation_line_id.ids,
'sponsorship_payment': True, 'sponsorship_payment': True,
'default_sponsorship_payment': True, 'default_sponsorship_payment': True,
'wiz_id': self.id '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.donation_detail_id.sponsor_id.id,
}, },
'target': 'new', 'target': 'new',