From af3293c7a8fc3e2deeabf7725894b437ede67587 Mon Sep 17 00:00:00 2001 From: younes Date: Mon, 22 Sep 2025 13:07:35 +0100 Subject: [PATCH] IMP benefit --- .../views/empowerment_management.xml | 6 ++-- .../odex25_program_activity/views/program.xml | 6 ++-- odex25_ensan/odex_benefit/__manifest__.py | 2 +- odex25_ensan/odex_benefit/i18n/ar_001.po | 32 ++++++++++++------- odex25_ensan/odex_benefit/models/benefit.py | 25 +++++++++++++++ .../odex_benefit/models/family_members.py | 30 ++++++++--------- .../static/src/scss/custom_style.scss | 3 ++ .../odex_benefit/views/benefit_view.xml | 25 ++++++++++----- .../odex_benefit/views/family_members.xml | 5 +-- odex25_ensan/odex_benefit/views/template.xml | 8 +++++ 10 files changed, 97 insertions(+), 45 deletions(-) create mode 100644 odex25_ensan/odex_benefit/static/src/scss/custom_style.scss create mode 100644 odex25_ensan/odex_benefit/views/template.xml diff --git a/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml b/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml index 6926e71bd..478add025 100644 --- a/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml +++ b/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml @@ -177,9 +177,9 @@ attrs="{'invisible':[('is_dead','=',False)]}"/> - + + diff --git a/odex25_ensan/odex25_program_activity/views/program.xml b/odex25_ensan/odex25_program_activity/views/program.xml index eb7a1144d..16a2db01d 100644 --- a/odex25_ensan/odex25_program_activity/views/program.xml +++ b/odex25_ensan/odex25_program_activity/views/program.xml @@ -425,9 +425,9 @@ attrs="{'invisible':[('is_dead','=',False)]}"/> - + + diff --git a/odex25_ensan/odex_benefit/__manifest__.py b/odex25_ensan/odex_benefit/__manifest__.py index 4d6d163ab..1c4db1baa 100644 --- a/odex25_ensan/odex_benefit/__manifest__.py +++ b/odex25_ensan/odex_benefit/__manifest__.py @@ -16,7 +16,7 @@ 'data/server_actions.xml', 'data/email_temps.xml', 'data/visits_types_data.xml', - + 'views/template.xml', 'views/benefit_view.xml', 'views/users_inherit.xml', 'views/committees_view.xml', diff --git a/odex25_ensan/odex_benefit/i18n/ar_001.po b/odex25_ensan/odex_benefit/i18n/ar_001.po index 2af02cccc..7205589b9 100644 --- a/odex25_ensan/odex_benefit/i18n/ar_001.po +++ b/odex25_ensan/odex_benefit/i18n/ar_001.po @@ -2263,11 +2263,6 @@ msgstr "فرد مستفيد" msgid "Benefit Member count" msgstr "عدد المستفيدين" -#. module: odex_benefit -#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form -msgid "Benefit Members Count" -msgstr "عدد أفراد الأسرة المستفيدين" - #. module: odex_benefit #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form msgid "Benefit Mother" @@ -8331,7 +8326,6 @@ msgid "MotherFamily Name" msgstr "اسم عائلة الأم" #. module: odex_benefit -#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form #: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form msgid "Move Lines" msgstr "المستحقات الشهرية للأسرة" @@ -8713,11 +8707,6 @@ msgstr "الأم غير مستفيدة" msgid "Non Benefit Replacement Mother" msgstr "غير مستفيدة" -#. module: odex_benefit -#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form -msgid "Non Benfit Members Count" -msgstr "عدد أفراد الأسرة الغير المستفيدين" - #. module: odex_benefit #: code:addons/odex_benefit/models/benefit.py:0 #, python-format @@ -15602,4 +15591,23 @@ msgstr "" #: code:addons/odex_benefit/models/benefit.py:0 #, python-format msgid "Short Number must be 4 letters followed by 4 digits (e.g., ABCD1234)." -msgstr "يجب أن يتكون الرمز المختصر من 4 أحرف تليها 4 أرقام (مثال: ABCD1234)." \ No newline at end of file +msgstr "يجب أن يتكون الرمز المختصر من 4 أحرف تليها 4 أرقام (مثال: ABCD1234)." + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form +#, python-format +msgid "Benefit Members" +msgstr "الأفراد المستفيدين" + +#. module: odex_benefit +#: code:addons/odex_benefit/models/benefit.py:0 +#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form +#, python-format +msgid "Non Benefit Members" +msgstr "الأفراد غير المستفيدين" + +#. module: odex_benefit +#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form +msgid "Monthly expense" +msgstr "المصروف الشهري" \ No newline at end of file diff --git a/odex25_ensan/odex_benefit/models/benefit.py b/odex25_ensan/odex_benefit/models/benefit.py index 7d2efdd57..886e89876 100644 --- a/odex25_ensan/odex_benefit/models/benefit.py +++ b/odex25_ensan/odex_benefit/models/benefit.py @@ -844,6 +844,29 @@ class GrantBenefitProfile(models.Model): 'total_move_lines': self.env['account.move.line'].search_count([('benefit_family_id', '=', rec.id)]) }) + def action_view_benefit_members(self): + self.ensure_one() + return { + 'type': 'ir.actions.act_window', + 'name': _('Benefit Members'), + 'res_model': 'family.member', + 'view_mode': 'tree,form', + 'domain': [('id', 'in', self.member_ids.filtered(lambda m: m.member_status == 'benefit').ids)], + 'target': 'current', + } + + def action_view_non_benefit_members(self): + self.ensure_one() + action = { + 'type': 'ir.actions.act_window', + 'name': _('Non Benefit Members'), + 'res_model': 'family.member', + 'view_mode': 'tree,form', + 'domain': [('id', 'in', self.member_ids.filtered(lambda m: m.member_status == 'non_benefit').ids)], + 'target': 'current', + } + return action + def action_open_related_move_line_records(self): """ Opens a tree view with related records filtered by a dynamic domain """ move_lines = self.env['account.move.line'].search([ @@ -1790,6 +1813,8 @@ class GrantBenefitProfile(models.Model): 'mother_status', 'replacement_mother_income', 'replacement_mother_status', + 'mother_income', + 'mother_status', 'salary_ids.salary_amount', 'salary_ids.approved', ) diff --git a/odex25_ensan/odex_benefit/models/family_members.py b/odex25_ensan/odex_benefit/models/family_members.py index cf65ae713..5fc577bc5 100644 --- a/odex25_ensan/odex_benefit/models/family_members.py +++ b/odex25_ensan/odex_benefit/models/family_members.py @@ -194,7 +194,7 @@ class FamilyMemberProfile(models.Model): ('suspended_second_approve', 'Suspended Second Approved'), ('exception_second_approve', 'Waiting for General Manager'), ('black_list', 'Black List'), - ], string='state', tracking=True,compute='_get_state',store = True) + ], string='state', tracking=True,compute='_get_state',store = True, group_expand='_expand_states') state_a = fields.Selection([ ('draft', 'Draft'), ('new', 'Researcher Assignment'), @@ -262,13 +262,8 @@ class FamilyMemberProfile(models.Model): # ) # return super(FamilyMemberProfile, self).write(vals) - - @api.onchange('relationn_type') - def _onchange_relationn_type(self): - if self.relationn_type in ['mother', 'replacement_mother']: - return {'domain': {'member_location_conf': [('location_type', '=', 'mother_location')]}} - else: - return {'domain': {'member_location_conf': [('location_type', '=', 'member')]}} + def _expand_states(self, states, domain, order): + return [key for key, val in type(self).state.selection] @api.onchange('age') def _check_son_daughter_age(self): @@ -288,7 +283,7 @@ class FamilyMemberProfile(models.Model): def _compute_minor_siblings(self): for member in self: member.minor_siblings = any( - m.age_status == 'minor' and not m.is_dead + m.age_status == 'minor' and m.member_status == 'benefit' for m in member.benefit_id.member_ids ) @@ -490,6 +485,7 @@ class FamilyMemberProfile(models.Model): male_benefit_age = validation_setting.male_benefit_age exceptional_age_scientific_specialty = validation_setting.exceptional_age_scientific_specialty exceptional_age_medical_specialty = validation_setting.exceptional_age_medical_specialty + exceptional_age_has_disabilities = validation_setting.exceptional_age_has_disabilities minor_siblings_age = validation_setting.minor_siblings_age max_income_for_benefit = validation_setting.max_income_for_benefit rec.member_status = 'benefit' # Default to benefit @@ -509,7 +505,9 @@ class FamilyMemberProfile(models.Model): # Gender-specific checks elif rec.relationn.relation_type == 'son': if rec.age > male_benefit_age: - if current_education_status_id.specialization_ids.is_scientific_specialty and rec.age > exceptional_age_scientific_specialty and not rec.minor_siblings : + if rec.age > exceptional_age_has_disabilities and rec.disabilities_attachment_ids: + rec.member_status = 'non_benefit' + elif current_education_status_id.specialization_ids.is_scientific_specialty and rec.age > exceptional_age_scientific_specialty and not rec.minor_siblings : rec.member_status = 'non_benefit' elif current_education_status_id.specialization_ids.is_medical_specialty and rec.age > exceptional_age_medical_specialty and not rec.minor_siblings: rec.member_status = 'non_benefit' @@ -520,9 +518,9 @@ class FamilyMemberProfile(models.Model): if rec.is_work: if rec.member_income > max_income_for_benefit: rec.member_status = 'non_benefit' - if not rec.is_married and current_education_status_id.education_status in ['illiterate']: + if not rec.is_married and rec.education_status in ['illiterate']: rec.member_status = 'non_benefit' - if not rec.is_married and current_education_status_id.education_status in ['educated'] and current_education_status_id.case_study in [ + if not rec.is_married and rec.education_status in ['educated'] and current_education_status_id.case_study in [ 'graduate', 'intermittent']: rec.member_status = 'non_benefit' if not rec.member_location_conf.is_benefit: @@ -532,7 +530,7 @@ class FamilyMemberProfile(models.Model): elif rec.relationn.relation_type == 'daughter': if rec.age < female_benefit_age and rec.is_married: rec.member_status = 'non_benefit' - if rec.age < female_benefit_age and rec.is_work and current_education_status_id.education_status not in ['educated'] and current_education_status_id.case_study != 'continuous': + if rec.age < female_benefit_age and rec.is_work and rec.education_status not in ['educated'] and current_education_status_id.case_study != 'continuous': rec.member_status = 'non_benefit' if rec.age > female_benefit_age: if rec.age > minor_siblings_age and not rec.minor_siblings: @@ -548,11 +546,11 @@ class FamilyMemberProfile(models.Model): rec.member_status = 'non_benefit' # elif not rec.minor_siblings: # rec.member_status = 'non_benefit' - if rec.is_work and rec.member_income > max_income_for_benefit and current_education_status_id.education_status in ['educated'] and current_education_status_id.case_study == 'continuous': + 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' - if rec.is_work and current_education_status_id.education_status in ['illiterate'] : + if rec.is_work and rec.education_status in ['illiterate'] : rec.member_status = 'non_benefit' - if rec.is_work and current_education_status_id.education_status in ['educated'] and current_education_status_id.case_study in [ + if rec.is_work and rec.education_status in ['educated'] and current_education_status_id.case_study in [ 'graduate', 'intermittent']: rec.member_status = 'non_benefit' if not rec.member_location_conf.is_benefit: diff --git a/odex25_ensan/odex_benefit/static/src/scss/custom_style.scss b/odex25_ensan/odex_benefit/static/src/scss/custom_style.scss new file mode 100644 index 000000000..88108a295 --- /dev/null +++ b/odex25_ensan/odex_benefit/static/src/scss/custom_style.scss @@ -0,0 +1,3 @@ +.custom_stat_value .o_stat_value { + color: #FF0000 !important; +} \ No newline at end of file diff --git a/odex25_ensan/odex_benefit/views/benefit_view.xml b/odex25_ensan/odex_benefit/views/benefit_view.xml index f7632e490..08cb5f501 100644 --- a/odex25_ensan/odex_benefit/views/benefit_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_view.xml @@ -223,15 +223,24 @@ - - -