From 729ed1b5d4791535a618db7e314c309952e41145 Mon Sep 17 00:00:00 2001 From: younes Date: Sun, 21 Sep 2025 13:41:38 +0100 Subject: [PATCH] IMP benefit --- .../views/empowerment_management.xml | 9 +-- .../odex25_program_activity/views/program.xml | 9 +-- odex25_ensan/odex_benefit/i18n/ar_001.po | 12 +++- odex25_ensan/odex_benefit/models/benefit.py | 4 +- .../odex_benefit/models/family_members.py | 12 +++- .../odex_benefit/views/benefit_view.xml | 61 ++++++++++------- .../odex_benefit/views/family_members.xml | 68 +++++++++++-------- 7 files changed, 101 insertions(+), 74 deletions(-) diff --git a/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml b/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml index f782564f6..6926e71bd 100644 --- a/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml +++ b/odex25_ensan/odex25_empowermentmanagement/views/empowerment_management.xml @@ -177,8 +177,9 @@ attrs="{'invisible':[('is_dead','=',False)]}"/> - + @@ -215,10 +216,6 @@ options="{'no_create': True, 'no_create_edit': True}" groups="!odex_benefit.group_benefit_manager"/> - diff --git a/odex25_ensan/odex25_program_activity/views/program.xml b/odex25_ensan/odex25_program_activity/views/program.xml index 5d74e9452..eb7a1144d 100644 --- a/odex25_ensan/odex25_program_activity/views/program.xml +++ b/odex25_ensan/odex25_program_activity/views/program.xml @@ -425,8 +425,9 @@ attrs="{'invisible':[('is_dead','=',False)]}"/> - + @@ -468,10 +469,6 @@ options="{'no_create': True, 'no_create_edit': True}" groups="!odex_benefit.group_benefit_manager"/> - diff --git a/odex25_ensan/odex_benefit/i18n/ar_001.po b/odex25_ensan/odex_benefit/i18n/ar_001.po index 3394a4182..b675ae2d5 100644 --- a/odex25_ensan/odex_benefit/i18n/ar_001.po +++ b/odex25_ensan/odex_benefit/i18n/ar_001.po @@ -1512,12 +1512,14 @@ msgstr "موافقة" #. module: odex_benefit #: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__action_type__approved +#: model:ir.model.fields.selection,name:odex_benefit.selection__family_member__action_type__approved #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form msgid "Approved" msgstr "معتمد" #. module: odex_benefit #: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__action_type__suspended +#: model:ir.model.fields.selection,name:odex_benefit.selection__family_member__action_type__suspended #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form msgid "Suspended" msgstr "ايقاف" @@ -4589,6 +4591,7 @@ msgstr "بانتظار الاسرة" #. module: odex_benefit #: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_sms_configuration__state__edit_info +#: model:ir.model.fields.selection,name:odex_benefit.selection__family_member__action_type__edit_info #: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__action_type__edit_info #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form msgid "Edit Information" @@ -4892,6 +4895,7 @@ msgstr "استثنائية" #. module: odex_benefit #: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__action_type__exception +#: model:ir.model.fields.selection,name:odex_benefit.selection__family_member__action_type__exception msgid "Exception" msgstr "استثناء" @@ -8242,7 +8246,6 @@ msgstr "دخل الأم" #. module: odex_benefit #: code:addons/odex_benefit/models/benefit_config.py:0 #: model:ir.model.fields,field_description:odex_benefit.field_family_member__mother_location -#: model:ir.model.fields,field_description:odex_benefit.field_family_member__mother_location_conf #: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__mother_location #: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__mother_location_conf #: model:ir.model.fields.selection,name:odex_benefit.selection__location_settings__location_type__mother_location @@ -12256,6 +12259,7 @@ msgstr "اسناد الاخصائي" #. module: odex_benefit #: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__action_type__new +#: model:ir.model.fields.selection,name:odex_benefit.selection__family_member__action_type__new #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form #, python-format msgid "New" @@ -14832,6 +14836,7 @@ msgstr "" "%s يجب أن يحتوي فقط على الأحرف الأبجدية والمسافات. الأرقام والرموز الخاصة غير مسموح بها." #. module: odex_benefit +#: model:ir.model.fields,field_description:odex_benefit.field_family_member__action_type #: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__action_type msgid "Action Type" msgstr "نوع الإجراء" @@ -15547,3 +15552,8 @@ msgstr "" "\n" " " +#. module: odex_benefit +#: 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 diff --git a/odex25_ensan/odex_benefit/models/benefit.py b/odex25_ensan/odex_benefit/models/benefit.py index 08610c282..cd65382f7 100644 --- a/odex25_ensan/odex_benefit/models/benefit.py +++ b/odex25_ensan/odex_benefit/models/benefit.py @@ -1872,7 +1872,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': Relation.id, 'mother_marital_conf': rec.mother_marital_conf.id, - 'mother_location_conf': rec.mother_location_conf.id, + 'member_location_conf': rec.mother_location_conf.id, 'age': rec.mother_age, 'is_work': rec.is_mother_work, 'member_income': rec.mother_income, @@ -1909,7 +1909,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': rec.replacement_mother_relation.id, 'mother_marital_conf': rec.replacement_mother_marital_conf.id, - 'mother_location_conf': rec.replacement_mother_location_conf.id, + 'member_location_conf': rec.replacement_mother_location_conf.id, 'age': rec.replacement_mother_age, 'is_work': rec.replacement_is_mother_work, 'member_income': rec.replacement_mother_income, diff --git a/odex25_ensan/odex_benefit/models/family_members.py b/odex25_ensan/odex_benefit/models/family_members.py index 2033b1907..635c03cb6 100644 --- a/odex25_ensan/odex_benefit/models/family_members.py +++ b/odex25_ensan/odex_benefit/models/family_members.py @@ -42,7 +42,7 @@ class FamilyMemberProfile(models.Model): ('study_inside_saudi_arabia', 'Study Inside Saudi Arabia'),('study_outside_saudi_arabia', 'Study Outside Saudi Arabia'), ('rehabilitation_center_for_the_disabled', 'Rehabilitation center for the disabled'),('house_of_social_observations', 'House of Social Observations'), ('girls_home','Girls Home'),('university_housing','University Housing'),('with_husband','With_husband'),('work_inside_saudi_arabia','Work Inside Saudi Arabia')], string="Member Location") - member_location_conf = fields.Many2one('location.settings',string='Member Location',domain="[('location_type','=','member')]") + member_location_conf = fields.Many2one('location.settings',string='Member Location') # member_location = fields.Many2one('member.location', string="Member Location") birth_date = fields.Date(string="Birth Date") age = fields.Integer(string="Age", compute='_compute_get_age_date',store=True) @@ -59,6 +59,7 @@ class FamilyMemberProfile(models.Model): is_married = fields.Boolean('Is Married?') marriage_certificate = fields.Many2many('ir.attachment','member_marriage_cert_rel','member_id','attachment_id',string="Marriage Certificate") relationn = fields.Many2one('relation.settings',domain="['|',('relation_type','=','son'),('relation_type','=','daughter')]",string="Relation") + relationn_type = fields.Selection(related="relationn.relation_type") relation = fields.Selection( [('son', _('Son')), ('daughter', _('Daughter'))]) mother_marital = fields.Selection( @@ -69,7 +70,6 @@ class FamilyMemberProfile(models.Model): mother_location = fields.Selection( [('with_husband_and_children', _('With Husband And Children')), ('with_children', _('With Children')), ('not_live_with_children', _('Not live with children'))], string='Mother Location') - mother_location_conf = fields.Many2one('location.settings',string='Mother Location',domain="[('location_type','=','mother_location')]") attachment_ids = fields.One2many("ir.attachment",'member_id',domain=[('hobbies_id', '=', False),('diseases_id', '=', False),('disabilities_id', '=', False)]) hobbies_attachment_ids = fields.One2many('ir.attachment', 'member_id', string='Hobbies Attachments',domain=[('hobbies_id', '!=', False)]) diseases_attachment_ids = fields.One2many('ir.attachment', 'member_id', string='Diseases Attachments',domain=[('diseases_id', '!=', False)]) @@ -204,7 +204,6 @@ class FamilyMemberProfile(models.Model): ('first_refusal', 'First Refusal'), ('second_approve', 'Second Approved'), ('refused', 'Refused'), - ('suspended_second_approve', 'Suspended Second Approved'), ('exception_second_approve', 'Waiting for General Manager'), ('black_list', 'Black List'), @@ -262,6 +261,13 @@ class FamilyMemberProfile(models.Model): # _("You should at least insert one current/previous education status!") # ) # 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')]}} @api.depends('age_status', 'is_dead','benefit_id.member_ids.age_status','benefit_id.member_ids.is_dead') def _compute_minor_siblings(self): diff --git a/odex25_ensan/odex_benefit/views/benefit_view.xml b/odex25_ensan/odex_benefit/views/benefit_view.xml index c1e814d58..65373a425 100644 --- a/odex25_ensan/odex_benefit/views/benefit_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_view.xml @@ -430,11 +430,14 @@
- - -
@@ -512,8 +515,8 @@ + widget="many2many_attachment_preview" + attrs="{'invisible':[('is_mother_work','=',False)]}"/> - - @@ -668,8 +673,8 @@ + widget="many2many_attachment_preview" + attrs="{'invisible':[('replacement_is_mother_work','=',False)]}"/> +