From 258bc8d3d2a4929feb0f38931cc0f9fcd29a968a Mon Sep 17 00:00:00 2001 From: younes Date: Tue, 6 Jan 2026 08:53:29 +0100 Subject: [PATCH 1/2] [IMP] odex_benefit: IMP benefit --- odex25_benefit/odex_benefit/i18n/ar_001.po | 2 +- odex25_benefit/odex_benefit/models/benefit.py | 19 ++++++++++++++----- .../odex_benefit/models/family_members.py | 15 +++++++++++++-- .../odex_benefit/views/benefit_view.xml | 7 +++---- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/odex25_benefit/odex_benefit/i18n/ar_001.po b/odex25_benefit/odex_benefit/i18n/ar_001.po index 12655f354..c6acd22ea 100644 --- a/odex25_benefit/odex_benefit/i18n/ar_001.po +++ b/odex25_benefit/odex_benefit/i18n/ar_001.po @@ -1138,7 +1138,7 @@ msgstr "حساب" #. module: odex_benefit #: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__acc_holder_name msgid "Account Holder Name" -msgstr "اسم مالك الحساب" +msgstr "اسم مالك الحساب بالبنك" #. module: odex_benefit #: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__family_member_id diff --git a/odex25_benefit/odex_benefit/models/benefit.py b/odex25_benefit/odex_benefit/models/benefit.py index 511499cd9..793f280f1 100644 --- a/odex25_benefit/odex_benefit/models/benefit.py +++ b/odex25_benefit/odex_benefit/models/benefit.py @@ -849,13 +849,22 @@ class GrantBenefitProfile(models.Model): def _compute_estimated_rent_amount(self): for rec in self: estimated_rent_amount = 0.0 - if rec.rent_amount > 0 and rec.property_type_id and rec.property_type_code == 'rent': + rent_line = False + if rec.property_type_id and rec.property_type_code == 'rent': if rec.branch_custom_id.branch_type == 'branches': - estimated_rent_amount = self.env['rent.lines'].search( - [('benefit_count', '=', rec.benefit_member_count)], order="estimated_rent_branches desc",limit=1).estimated_rent_branches + rent_line = self.env['rent.lines'].search( + [('benefit_count', '=', rec.benefit_member_count)], order="estimated_rent_branches desc",limit=1) + if rent_line: + estimated_rent_amount = rent_line.estimated_rent_branches else: - estimated_rent_amount = self.env['rent.lines'].search( - [('benefit_count', '=', rec.benefit_member_count)], order="estimated_rent_governorate desc",limit=1).estimated_rent_governorate + rent_line = self.env['rent.lines'].search( + [('benefit_count', '=', rec.benefit_member_count)], order="estimated_rent_governorate desc",limit=1) + if rent_line: + estimated_rent_amount = rent_line.estimated_rent_governorate + + if rec.property_type_id.is_shared and rent_line and rent_line.discount_rate_shared_housing: + discount = rent_line.discount_rate_shared_housing / 100.0 + estimated_rent_amount *= discount rec.estimated_rent_amount = estimated_rent_amount / 12.0 def assign_sequence_to_all(self): diff --git a/odex25_benefit/odex_benefit/models/family_members.py b/odex25_benefit/odex_benefit/models/family_members.py index 1e4278d0f..016688d45 100644 --- a/odex25_benefit/odex_benefit/models/family_members.py +++ b/odex25_benefit/odex_benefit/models/family_members.py @@ -521,6 +521,7 @@ class FamilyMemberProfile(models.Model): 'member_education_status_ids.specialization_ids', 'member_education_status_ids.education_status', 'member_education_status_ids.case_study', + 'disabilities_attachment_ids', 'relationn', 'birth_date', 'is_married', @@ -650,8 +651,18 @@ class FamilyMemberProfile(models.Model): rec.member_status = 'non_benefit' reasons.append(_("She is employed and not enrolled in an educational institution.")) if age_exceeded: - rec.member_status = 'non_benefit' - reasons.append(_("She has exceeded the maximum age limit of %s years.") % female_benefit_age) + if rec.age <= exceptional_age_has_disabilities and rec.disabilities_attachment_ids and rec.minor_siblings: + rec.member_status = 'benefit' + else: + if rec.age > exceptional_age_has_disabilities and rec.disabilities_attachment_ids: + rec.member_status = 'non_benefit' + reasons.append( + _("She has a physical or intellectual disability but is over %s years of age.") + % exceptional_age_has_disabilities + ) + else: + rec.member_status = 'non_benefit' + reasons.append(_("She has exceeded the maximum age limit of %s years.") % female_benefit_age) if rec.is_work and rec.member_income > max_income_for_benefit and rec.education_status in [ 'educated'] and current_education_status_id.case_study == 'continuous': rec.member_status = 'non_benefit' diff --git a/odex25_benefit/odex_benefit/views/benefit_view.xml b/odex25_benefit/odex_benefit/views/benefit_view.xml index 148b6eb76..9cdf64df8 100644 --- a/odex25_benefit/odex_benefit/views/benefit_view.xml +++ b/odex25_benefit/odex_benefit/views/benefit_view.xml @@ -483,7 +483,7 @@ />