From b1a353d52de576f490ad97405da22a41313b098b Mon Sep 17 00:00:00 2001 From: eman Date: Sat, 14 Dec 2024 19:26:42 +0200 Subject: [PATCH] Benefit --- odex25_ensan/odex_benefit/models/benefit.py | 22 ++++++++------- .../odex_benefit/models/benefit_config.py | 8 ++++++ .../odex_benefit/models/family_members.py | 10 ++++--- .../odex_benefit/security/ir.model.access.csv | 3 +- .../odex_benefit/views/actions_and_menus.xml | 18 ++++++++++-- .../views/benefit_config_view.xml | 28 +++++++++++++++++++ .../odex_benefit/views/benefit_view.xml | 15 ++++++---- .../odex_benefit/views/family_members.xml | 8 ++++-- .../models/takaful_sponorship_model.py | 1 + .../views/takaful_sponorship_view.xml | 1 + 10 files changed, 87 insertions(+), 27 deletions(-) diff --git a/odex25_ensan/odex_benefit/models/benefit.py b/odex25_ensan/odex_benefit/models/benefit.py index 043117069..a31dbcc6e 100644 --- a/odex25_ensan/odex_benefit/models/benefit.py +++ b/odex25_ensan/odex_benefit/models/benefit.py @@ -195,6 +195,7 @@ class GrantBenefitProfile(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')]") is_mother_work = fields.Boolean('Is Mother Work?') mother_has_disabilities = fields.Boolean('Has Disabilities?') mother_income = fields.Float("Mother Income") @@ -480,6 +481,7 @@ class GrantBenefitProfile(models.Model): replacement_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='Replacement Mother Location') + replacement_mother_location_conf = fields.Many2one('location.settings',string='Replacement Mother Location',domain="[('location_type','=','mother_location')]") replacement_is_mother_work = fields.Boolean('Is Replacement Mother Work?') replacement_mother_has_disabilities = fields.Boolean('Has Disabilities?') replacement_mother_income = fields.Float("Replacement Mother Income") @@ -774,14 +776,14 @@ class GrantBenefitProfile(models.Model): 'url': url } - @api.depends('mother_marital_conf', 'mother_income', 'mother_location', 'mother_country_id', 'state') + @api.depends('mother_marital_conf', 'mother_income', 'mother_location_conf', 'mother_country_id', 'state') def check_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: rec.mother_status = False - if rec.mother_location == 'not_live_with_children' or not rec.mother_marital_conf.is_benefit or rec.state == 'suspended_second_approve': + if not rec.mother_location_conf.is_benefit or not rec.mother_marital_conf.is_benefit or rec.state == 'suspended_second_approve': rec.mother_status = 'non_benefit' elif rec.mother_marital_conf.is_benefit : if rec.is_mother_work and rec.mother_country_id.code == 'SA' or ( @@ -796,14 +798,14 @@ class GrantBenefitProfile(models.Model): rec.mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'): rec.mother_status = 'benefit' - @api.depends('replacement_mother_marital_conf', 'replacement_mother_income', 'replacement_mother_location', 'replacement_mother_country_id', 'state') + @api.depends('replacement_mother_marital_conf', 'replacement_mother_income', 'replacement_mother_location_conf', 'replacement_mother_country_id', 'state') 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: rec.replacement_mother_status = False - if rec.replacement_mother_location == 'not_live_with_children' or not rec.replacement_mother_marital_conf.is_benefit or rec.state == 'suspended_second_approve': + if not rec.replacement_mother_location_conf.is_benefit or not rec.replacement_mother_marital_conf.is_benefit or rec.state == 'suspended_second_approve': rec.replacement_mother_status = 'non_benefit' elif rec.replacement_mother_marital_conf.is_benefit: if rec.replacement_is_mother_work and rec.replacement_mother_country_id.code == 'SA' or ( @@ -1368,7 +1370,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': self.env['relation.settings'].search([('relation_type','=','mother')]).id, 'mother_marital_conf': rec.mother_marital_conf.id, - 'mother_location': rec.mother_location, + 'mother_location_conf': rec.mother_location_conf.id, 'age': rec.mother_age, 'is_work': rec.is_mother_work, 'has_disabilities':rec.mother_has_disabilities, @@ -1418,7 +1420,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': rec.replacement_mother_relation.id, 'mother_marital_conf': rec.replacement_mother_marital_conf.id, - 'mother_location': rec.replacement_mother_location, + 'mother_location': rec.replacement_mother_location_conf.id, 'age': rec.replacement_mother_age, 'is_work': rec.replacement_is_mother_work, 'has_disabilities': rec.replacement_mother_has_disabilities, @@ -1468,7 +1470,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': self.env['relation.settings'].search([('relation_type','=','mother')]).id, 'mother_marital_conf': rec.mother_marital_conf.id, - 'mother_location': rec.mother_location, + 'mother_location_conf': rec.mother_location_conf.id, 'age': rec.mother_age, 'is_work': rec.is_mother_work, 'has_disabilities': rec.mother_has_disabilities, @@ -1518,7 +1520,7 @@ class GrantBenefitProfile(models.Model): 'gender': 'female', 'relationn': rec.replacement_mother_relation.id, 'mother_marital_conf': rec.replacement_mother_marital_conf.id, - 'mother_location': rec.replacement_mother_location, + 'mother_location': rec.replacement_mother_location_conf.id, 'age': rec.replacement_mother_age, 'is_work': rec.replacement_is_mother_work, 'has_disabilities': rec.replacement_mother_has_disabilities, @@ -1890,7 +1892,7 @@ class GrantBenefitProfile(models.Model): if partner_exist or benefit_exist: raise ValidationError(_("The account number already exists!")) - @api.onchange('mother_marital_conf', 'mother_location', 'mother_income') + @api.onchange('mother_marital_conf', 'mother_location_conf', 'mother_income') def _onchange_mother_info(self): res = {} for rec in self: @@ -1899,7 +1901,7 @@ class GrantBenefitProfile(models.Model): 'message': _('Not Benefit')} return res - @api.onchange('replacement_mother_marital_conf', 'replacement_mother_location', 'replacement_mother_income') + @api.onchange('replacement_mother_marital_conf', 'replacement_mother_location_conf', 'replacement_mother_income') def _onchange_replacement_mother_info(self): res = {} for rec in self: diff --git a/odex25_ensan/odex_benefit/models/benefit_config.py b/odex25_ensan/odex_benefit/models/benefit_config.py index 37dbe0acb..ac53220d2 100644 --- a/odex25_ensan/odex_benefit/models/benefit_config.py +++ b/odex25_ensan/odex_benefit/models/benefit_config.py @@ -610,6 +610,14 @@ class RelationSettings(models.Model): relation_type = fields.Selection( [('son', _('Son')), ('daughter', _('Daughter')),('mother', _('Mother')),('replacement_mother', _('Replacement Mother')),('other relation', _('Other Relation'))]) +class LocationSettings(models.Model): + _name = 'location.settings' + _description = "Location Settings" + + name = fields.Char(string='name') + location_type = fields.Selection([('member', _('Member')), ('mother_location', _('Mother Location'))]) + is_benefit = fields.Boolean(string='Is Benefit?') + class AttachmentsSettings(models.Model): _name = 'attachments.settings' _description = "Attachments Settings" diff --git a/odex25_ensan/odex_benefit/models/family_members.py b/odex25_ensan/odex_benefit/models/family_members.py index 4af88967b..376c8b5e2 100644 --- a/odex25_ensan/odex_benefit/models/family_members.py +++ b/odex25_ensan/odex_benefit/models/family_members.py @@ -41,6 +41,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 = 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 +60,7 @@ 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')]") need_transportation = fields.Boolean('Need Transportation?') 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)]) @@ -326,7 +328,7 @@ class FamilyMemberProfile(models.Model): # 'code': self.benefit_id.code, # }) @api.depends('relationn','birth_date', 'is_scientific_specialty', 'is_medical_specialty', 'has_disabilities', 'is_married', - 'minor_siblings','member_income','is_married','member_location','education_status','case_study','state','is_dead') + 'minor_siblings','member_income','is_married','member_location_conf','education_status','case_study','state','is_dead') def check_member_status(self): for rec in self: if rec.state == 'second_approve' and rec.is_excluded_suspension: @@ -368,7 +370,7 @@ class FamilyMemberProfile(models.Model): if not rec.is_married and rec.education_status in ['educated'] and rec.case_study in [ 'graduate', 'intermittent']: rec.member_status = 'non_benefit' - if rec.member_location in ['with_relative', 'study_outside_saudi_arabia']: + if not rec.member_location_conf.is_benefit: rec.member_status = 'non_benefit' if rec.state == 'suspended_second_approve' or rec.is_dead == True: rec.member_status = 'non_benefit' @@ -398,7 +400,7 @@ class FamilyMemberProfile(models.Model): if rec.is_work and rec.education_status in ['educated'] and rec.case_study in [ 'graduate', 'intermittent']: rec.member_status = 'non_benefit' - if rec.member_location in ['with_relative', 'study_outside_saudi_arabia']: + if not rec.member_location_conf.is_benefit: rec.member_status = 'non_benefit' if rec.state == 'suspended_second_approve' or rec.is_dead == True: rec.member_status = 'non_benefit' @@ -467,7 +469,7 @@ class FamilyMemberProfile(models.Model): # _('The ID Number Already Exist!')) @api.onchange('relationn','member_status','gender','birth_date', 'is_scientific_specialty', 'is_medical_specialty', 'has_disabilities', 'is_married', - 'minor_siblings','member_income','is_married','member_location','education_status','case_study') + 'minor_siblings','member_income','is_married','member_location_conf','education_status','case_study') def onchange_member_status(self): res ={} for rec in self: diff --git a/odex25_ensan/odex_benefit/security/ir.model.access.csv b/odex25_ensan/odex_benefit/security/ir.model.access.csv index c4ff12653..cc29158a9 100644 --- a/odex25_ensan/odex_benefit/security/ir.model.access.csv +++ b/odex25_ensan/odex_benefit/security/ir.model.access.csv @@ -138,4 +138,5 @@ access_water_bill_lines,access_water_bill_lines,model_water_bill_lines,base.grou access_age_category,access_age_category,model_age_category,base.group_user,1,1,1,1 access_complaints_category,access_complaints_category,model_complaints_category,base.group_user,1,1,1,1 access_family_complaints,access_family_complaints,model_family_complaints,base.group_user,1,1,1,1 -access_buy_home_lines,access_buy_home_lines,model_buy_home_lines,base.group_user,1,1,1,1 \ No newline at end of file +access_buy_home_lines,access_buy_home_lines,model_buy_home_lines,base.group_user,1,1,1,1 +access_location_settings,access_location_settings,model_location_settings,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/odex25_ensan/odex_benefit/views/actions_and_menus.xml b/odex25_ensan/odex_benefit/views/actions_and_menus.xml index 08a87e86f..7e8589c36 100644 --- a/odex25_ensan/odex_benefit/views/actions_and_menus.xml +++ b/odex25_ensan/odex_benefit/views/actions_and_menus.xml @@ -258,6 +258,15 @@

Create the Relation

+ + + Location Settings + location.settings + tree,form + +

Create the Location +

+
Marital Status @@ -878,15 +887,18 @@ + + sequence="5"/> + sequence="6"/> + sequence="7"/> diff --git a/odex25_ensan/odex_benefit/views/benefit_config_view.xml b/odex25_ensan/odex_benefit/views/benefit_config_view.xml index 29f52bfdb..b86248595 100644 --- a/odex25_ensan/odex_benefit/views/benefit_config_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_config_view.xml @@ -983,6 +983,34 @@ + + + Location Settings + location.settings + +
+ + + + + + + + + +
+
+
+ + Location Settings + location.settings + + + + + + + Attachments Settings diff --git a/odex25_ensan/odex_benefit/views/benefit_view.xml b/odex25_ensan/odex_benefit/views/benefit_view.xml index 1ed5701aa..cb5121819 100644 --- a/odex25_ensan/odex_benefit/views/benefit_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_view.xml @@ -342,7 +342,8 @@ - + + @@ -448,8 +449,8 @@ - + + @@ -548,7 +549,8 @@ - + + @@ -573,7 +575,8 @@ - + + @@ -711,7 +714,7 @@ - + diff --git a/odex25_ensan/odex_benefit/views/family_members.xml b/odex25_ensan/odex_benefit/views/family_members.xml index e8ee9e733..85121ded8 100644 --- a/odex25_ensan/odex_benefit/views/family_members.xml +++ b/odex25_ensan/odex_benefit/views/family_members.xml @@ -56,7 +56,8 @@ - + + @@ -75,7 +76,8 @@ - + + @@ -212,7 +214,7 @@ - + diff --git a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py index c7e5d68ad..efd2fbd2b 100644 --- a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py +++ b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py @@ -1055,5 +1055,6 @@ class AnotherSponsors(models.Model): sponsor_name = fields.Char(string="Sponsor Name") sponsor_phone = fields.Char(string="Sponsor Phone") + sponsor_id_number = fields.Char(string="Sponsor ID Number") sponsorship_id = fields.Many2one('takaful.sponsorship') diff --git a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml index 48c2de8ff..dd1257b6e 100644 --- a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml +++ b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml @@ -186,6 +186,7 @@ +