From c74cb8f89dd3e457928c6dce201ca34b7515105b Mon Sep 17 00:00:00 2001 From: younes Date: Mon, 19 Jan 2026 15:33:53 +0100 Subject: [PATCH 1/2] [IMP] odex_benefit: IMP benefit --- odex25_benefit/odex_benefit/models/benefit.py | 57 +++++++------------ .../odex_benefit/models/benefit_config.py | 2 + .../views/benefit_config_view.xml | 14 ++++- .../odex_benefit/views/benefit_view.xml | 6 +- 4 files changed, 39 insertions(+), 40 deletions(-) diff --git a/odex25_benefit/odex_benefit/models/benefit.py b/odex25_benefit/odex_benefit/models/benefit.py index 2dd9ee776..e0e4ab0d5 100644 --- a/odex25_benefit/odex_benefit/models/benefit.py +++ b/odex25_benefit/odex_benefit/models/benefit.py @@ -750,10 +750,6 @@ class GrantBenefitProfile(models.Model): @api.depends('is_mother_work','mother_salary_ids','mother_expenses_ids','mother_debits_ids') def _compute_mother_net_income(self): for rec in self: - if not rec.is_mother_work: - rec.mother_net_income = 0.0 - continue - deductions = ( sum(rec.mother_expenses_ids.filtered('deduct_from_family_income').mapped('amount')) + sum(rec.mother_debits_ids.filtered('deduct_from_family_income').mapped('monthly_installment')) @@ -1424,30 +1420,28 @@ class GrantBenefitProfile(models.Model): return status, reasons def check_replacement_mother_status(self): - validation_setting = self.env["family.validation.setting"].search([], limit=1) - mini_income_for_mother = validation_setting.mini_income_for_mother - max_income_for_mother = validation_setting.max_income_for_mother for rec in self: reasons = [] status = 'benefit' if not rec.add_replacement_mother: continue - if not rec.replacement_mother_location_conf.is_benefit or not rec.replacement_mother_marital_conf.is_benefit or rec.state in ['suspended_second_approve','refused']: + if rec.state in ['suspended_second_approve', 'refused']: status = 'non_benefit' - reasons.append(_("The replacement mother's marital or location conditions are not eligible.")) - elif rec.replacement_mother_marital_conf.is_benefit: - if rec.replacement_is_mother_work and rec.replacement_mother_country_id.code == 'SA' or ( - rec.replacement_mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'): - if mini_income_for_mother < rec.replacement_mother_income <= max_income_for_mother: - status = 'non_benefit' - reasons.append(_("The replacement mother's income is between minimum and maximum thresholds.")) - elif rec.replacement_mother_income <= mini_income_for_mother: - status = 'benefit' - elif rec.replacement_mother_income > max_income_for_mother: - status = 'benefit' - elif not rec.replacement_is_mother_work and rec.replacement_mother_country_id.code == 'SA' or ( - rec.replacement_mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'): - status = 'benefit' + reasons.append(_("Family is suspended or refused.")) + return status, reasons + + if not rec.replacement_mother_marital_conf or not rec.replacement_mother_location_conf: + status = 'non_benefit' + reasons.append(_("Replacement mother marital or location information is missing.")) + return status, reasons + + if not rec.replacement_mother_marital_conf.replacement_mother_is_benefit: + status = 'non_benefit' + reasons.append(_("The replacement mother's marital status is not eligible for benefits.")) + + if not rec.replacement_mother_location_conf.replacement_mother_is_benefit: + status = 'non_benefit' + reasons.append(_("The replacement mother's location is not eligible for benefits.")) return status, reasons def delete_from_db(self): @@ -2212,18 +2206,11 @@ class GrantBenefitProfile(models.Model): for rec in self: total = 0.0 rec.total_income = 0.0 - if not rec.add_replacement_mother: - if rec.mother_status == 'non_benefit': - total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) - elif rec.mother_status == 'benefit': - total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.mother_income - rec.total_income = total - if rec.add_replacement_mother: - if rec.replacement_mother_status == 'non_benefit': - total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) - elif rec.replacement_mother_status == 'benefit': - total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.replacement_mother_income - rec.total_income += total + if rec.mother_status == 'non_benefit': + total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + elif rec.mother_status == 'benefit': + total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.mother_income + rec.total_income = total def get_mother_name(self): for rec in self: @@ -2655,7 +2642,7 @@ class GrantBenefitProfile(models.Model): 'message': _('Not Benefit')} return res - @api.onchange('replacement_mother_marital_conf', 'replacement_mother_location_conf', 'replacement_mother_income') + @api.onchange('replacement_mother_marital_conf', 'replacement_mother_location_conf') def _onchange_replacement_mother_info(self): res = {} for rec in self: diff --git a/odex25_benefit/odex_benefit/models/benefit_config.py b/odex25_benefit/odex_benefit/models/benefit_config.py index acf02914e..b810e6d41 100644 --- a/odex25_benefit/odex_benefit/models/benefit_config.py +++ b/odex25_benefit/odex_benefit/models/benefit_config.py @@ -806,6 +806,7 @@ class LocationSettings(models.Model): location_type = fields.Selection([('member', _('Member')), ('mother_location', _('Mother Location'))]) is_benefit = fields.Boolean(string='Is Benefit?') is_far_from_family = fields.Boolean(string='Is Far From Family?') + replacement_mother_is_benefit = fields.Boolean(string="Replacement Mother Is Benefit?", default=True, ) class AttachmentsSettings(models.Model): _name = 'attachments.settings' @@ -897,6 +898,7 @@ class MaritalStatus(models.Model): name = fields.Char(string="Name") is_benefit = fields.Boolean(string='Is Benefit?') is_dead = fields.Boolean(string='Is Dead?') + replacement_mother_is_benefit = fields.Boolean(string="Replacement Mother Is Benefit?",default=True,) class AgeCategory(models.Model): _name = 'age.category' diff --git a/odex25_benefit/odex_benefit/views/benefit_config_view.xml b/odex25_benefit/odex_benefit/views/benefit_config_view.xml index 9a85a8a57..6f804938a 100644 --- a/odex25_benefit/odex_benefit/views/benefit_config_view.xml +++ b/odex25_benefit/odex_benefit/views/benefit_config_view.xml @@ -1016,9 +1016,13 @@ - + + + + + @@ -1033,6 +1037,7 @@ + @@ -1333,9 +1338,13 @@ - + + + + + @@ -1348,6 +1357,7 @@ + diff --git a/odex25_benefit/odex_benefit/views/benefit_view.xml b/odex25_benefit/odex_benefit/views/benefit_view.xml index 2e76c14b3..4cc7bb68c 100644 --- a/odex25_benefit/odex_benefit/views/benefit_view.xml +++ b/odex25_benefit/odex_benefit/views/benefit_view.xml @@ -909,7 +909,7 @@ - + @@ -929,7 +929,7 @@ - + - +
From f7b80a7332e24580b81b253b57902c6680a89517 Mon Sep 17 00:00:00 2001 From: younes Date: Mon, 19 Jan 2026 15:46:04 +0100 Subject: [PATCH 2/2] [IMP] odex_benefit: IMP benefit --- odex25_benefit/odex_benefit/i18n/ar_001.po | 33 ++++++++++++++++++- .../models/ir_attachment_inherit.py | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/odex25_benefit/odex_benefit/i18n/ar_001.po b/odex25_benefit/odex_benefit/i18n/ar_001.po index f05e4a111..2f7483c5a 100644 --- a/odex25_benefit/odex_benefit/i18n/ar_001.po +++ b/odex25_benefit/odex_benefit/i18n/ar_001.po @@ -18509,4 +18509,35 @@ msgstr "تجاوزت عمر %s وليس لديها اخوة قصر" #: code:addons/odex_benefit/models/family_members.py:0 #, python-format msgid "She is over %s years of age." -msgstr "تجاوزت عمر %s" \ No newline at end of file +msgstr "تجاوزت عمر %s" + +#. module: odex_benefit +#: model:ir.model.fields,field_description:odex_benefit.field_location_settings__replacement_mother_is_benefit +#: model:ir.model.fields,field_description:odex_benefit.field_marital_status__replacement_mother_is_benefit +msgid "Replacement Mother Is Benefit?" +msgstr "هل الأم البديلة مستفيدة؟" + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#, python-format +msgid "Family is suspended or refused." +msgstr "توقفت الأسرة أو تم رفضها." + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#, python-format +msgid "Replacement mother marital or location information is missing." +msgstr "معلومات الحالة الاجتماعية أو موقع السكن للأم البديلة مفقودة." + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#, python-format +msgid "The replacement mother's marital status is not eligible for benefits." +msgstr "الحالة الاجتماعية للأم البديلة غير مؤهلة للاستفادة." + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#, python-format +msgid "The replacement mother's location is not eligible for benefits." +msgstr "مكان سكن الأم البديلة غير مؤهل للاستفادة." + diff --git a/odex25_benefit/odex_benefit/models/ir_attachment_inherit.py b/odex25_benefit/odex_benefit/models/ir_attachment_inherit.py index ed443109c..ce6457f33 100644 --- a/odex25_benefit/odex_benefit/models/ir_attachment_inherit.py +++ b/odex25_benefit/odex_benefit/models/ir_attachment_inherit.py @@ -18,7 +18,7 @@ class BenefitAttachment(models.Model): attach_id = fields.Many2one('attachments.settings', string="Attach",domain=[('attach_type', '=', 'member_attach')]) hobbies_id = fields.Many2one('attachments.settings', string="Hobby",domain=[('attach_type', '=', 'hobbies_attach')]) diseases_id = fields.Many2one('attachments.settings', string="Diseases",domain=[('attach_type', '=', 'diseases_attach'), ('parent_id','=',False)]) - diseases_child_id = fields.Many2one('attachments.settings',string="Sub Disease",domain="[('parent_id','=',diseases_id)]") + diseases_child_id = fields.Many2one('attachments.settings',string="Sub Disease",domain="[('attach_type', '=', 'diseases_attach'),('parent_id','=',diseases_id)]") disabilities_id = fields.Many2one('attachments.settings', string="Disabilities",domain=[('attach_type', '=', 'disabilities_attach'), ('parent_id','=',False)]) disabilities_child_id = fields.Many2one('attachments.settings',string="Sub Disability",domain="[('parent_id','=',disabilities_id)]") hobby_attach = fields.Binary(attachment=True, string="Hobby Attach")