From 7618f9d7f272fc2cc3eab2239dc8d820db9a1af7 Mon Sep 17 00:00:00 2001 From: younes Date: Sun, 14 Sep 2025 12:15:10 +0100 Subject: [PATCH] IMP benefit --- odex25_ensan/odex_benefit/i18n/ar_001.po | 4 +- odex25_ensan/odex_benefit/models/benefit.py | 16 +- .../odex_benefit/models/family_debits.py | 14 +- .../odex_benefit/security/ir.model.access.csv | 4 +- .../odex_benefit/security/security_view.xml | 213 ++++++++---------- .../odex_benefit/views/benefit_view.xml | 93 ++++---- 6 files changed, 153 insertions(+), 191 deletions(-) diff --git a/odex25_ensan/odex_benefit/i18n/ar_001.po b/odex25_ensan/odex_benefit/i18n/ar_001.po index 4c85b59a4..42f4bc306 100644 --- a/odex25_ensan/odex_benefit/i18n/ar_001.po +++ b/odex25_ensan/odex_benefit/i18n/ar_001.po @@ -15291,8 +15291,8 @@ msgstr "تم اعتماده" #. module: odex_benefit #: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form -msgid "Expenses and Family Loans" -msgstr "الديون والالتزامات" +msgid "Expenses and Income" +msgstr "الدخل والالتزامات" #. module: odex_benefit #: model:ir.model.fields,field_description:odex_benefit.field_expenses_line__deduct_from_family_income diff --git a/odex25_ensan/odex_benefit/models/benefit.py b/odex25_ensan/odex_benefit/models/benefit.py index 504c1d086..aa7b9a263 100644 --- a/odex25_ensan/odex_benefit/models/benefit.py +++ b/odex25_ensan/odex_benefit/models/benefit.py @@ -52,20 +52,6 @@ class GrantBenefitProfile(models.Model): return partners.name_get() - @api.model - def search(self, args, offset=0, limit=None, order=None, count=False): - if not self.env.user.has_group("base.public_user") and not self.env.user.has_group("base.group_portal") : - if not self.env.user.has_group("odex_benefit.group_benefit_show_draft_record"): - args += [('state', '!=', 'draft')] - if not self.env.user.has_group("odex_benefit.group_benefit_manager") and self.env.user and self.env.user.id: - if self.env.user.has_group("odex_benefit.group_benefit_branch_manager"): - args += [('branch_custom_id.branch.manager_id', '=', self.env.user.employee_id.id)] - elif self.env.user.has_group("odex_benefit.group_benefit_woman_commitee"): - args += [('branch_custom_id.branch.operation_manager_id', '=', self.env.user.employee_id.id)] - elif self.env.user and self.env.user.id and self.env.user.has_group("odex_benefit.group_benefit_researcher"): - args += [('researcher_id.employee_id', '=', self.env.user.employee_id.id)] - return super(GrantBenefitProfile, self).search(args, offset, limit, order, count) - profile_step_count = fields.Integer() complete_registration_step = fields.Char(string="Complete Registration Step") complete_registration_done = fields.Boolean('Does Complete Registration Done ?') @@ -1999,7 +1985,7 @@ class GrantBenefitProfile(models.Model): 'is_work': rec.is_mother_work, 'member_income': rec.mother_income, 'education_status': rec.education_status, - 'member_education_status_ids': [(5, 0)] + [(4, replacement_education_id.id) for replacement_education_id in rec.replacement_education_status_ids], + 'member_education_status_ids': [(5, 0)] + [(4, mother_education_id.id) for mother_education_id in rec.mother_education_status_ids], 'case_study': rec.case_study, 'education_entity': rec.education_entity, 'last_education_entity': rec.last_education_entity, diff --git a/odex25_ensan/odex_benefit/models/family_debits.py b/odex25_ensan/odex_benefit/models/family_debits.py index fa6d4686a..7cdaaf0ea 100644 --- a/odex25_ensan/odex_benefit/models/family_debits.py +++ b/odex25_ensan/odex_benefit/models/family_debits.py @@ -36,11 +36,11 @@ class FamilyDebits(models.Model): for rec in self: rec.loan_remaining = rec.loan_amount - rec.loan_total_paid - # @api.depends('loan_amount','number_of_installments') - # def get_monthly_installment(self): - # for rec in self: - # if rec.loan_amount and rec.number_of_installments > 0 : - # rec.monthly_installment = rec.loan_amount / rec.number_of_installments - # else: - # rec.monthly_installment = 0 + @api.onchange('loan_amount','number_of_installments') + def get_monthly_installment(self): + for rec in self: + if rec.loan_amount and rec.number_of_installments > 0 : + rec.monthly_installment = rec.loan_amount / rec.number_of_installments + else: + rec.monthly_installment = 0 diff --git a/odex25_ensan/odex_benefit/security/ir.model.access.csv b/odex25_ensan/odex_benefit/security/ir.model.access.csv index b7cc2ef74..52ac8de10 100644 --- a/odex25_ensan/odex_benefit/security/ir.model.access.csv +++ b/odex25_ensan/odex_benefit/security/ir.model.access.csv @@ -160,4 +160,6 @@ access_grant_benefit_portal_user,access_grant_benefit_portal_user,model_grant_be access_visit_location_otp_wizard,access_visit_location_otp_wizard,model_visit_location_otp_wizard,,1,1,1,1 access_visit_skip_otp_wizard,access_visit_skip_otp_wizard,model_visit_skip_otp_wizard,,1,1,1,1 access_benefit_vehicle_model,access_benefit_vehicle_model,model_benefit_vehicle_model,,1,1,1,1 -access_visit_location_refusal_reason_wizard,access_visit_location_refusal_reason_wizard,model_visit_location_refusal_reason_wizard,,1,1,1,1 \ No newline at end of file +access_visit_location_refusal_reason_wizard,access_visit_location_refusal_reason_wizard,model_visit_location_refusal_reason_wizard,,1,1,1,1 +access_survey_user_input_group_benefit_info,survey.user_input.group_benefit_info,survey.model_survey_user_input,odex_benefit.group_benefit_info,1,0,0,0 +access_survey_user_input_line_group_benefit_info,survey.user_input.line.group_benefit_info,survey.model_survey_user_input_line,odex_benefit.group_benefit_info,1,0,0,0 \ No newline at end of file diff --git a/odex25_ensan/odex_benefit/security/security_view.xml b/odex25_ensan/odex_benefit/security/security_view.xml index a2b128094..29341a540 100644 --- a/odex25_ensan/odex_benefit/security/security_view.xml +++ b/odex25_ensan/odex_benefit/security/security_view.xml @@ -1,5 +1,5 @@ - + Beneficiaries Management Helps you manage Beneficiaries Program @@ -113,116 +113,112 @@ - - - - - - - - + + + Show All Benefits Profiles + + [(1, '=', 1)] + + + - - - - - - - + + Show Benefits Profiles of Own Branch + + [('branch_custom_id.branch.manager_id', '=', user.employee_id.id)] + + + - - - - - - - + + Show Benefits Profiles of Assigned Branch (Operation Manager) + + [('branch_custom_id.branch.operation_manager_id', '=', user.employee_id.id)] + + + - - - - - - - - - - - + + Show Benefits Profiles Created or Assigned (Researcher) + + ['|', ('create_uid','=',user.id),('researcher_id.employee_id', 'in', user.employee_id.ids)] + + + - - - - - - - - + + + Show All Visit Location + + [(1, '=', 1)] + + + - - - - - - - + + Show Visit Location of Own Branch + + [('benefit_id.branch_custom_id.branch.manager_id', '=', user.employee_id.id)] + + + - - - - - - - + + Show Visit Location of Assigned Branch (Operation Manager) + + [('benefit_id.branch_custom_id.branch.operation_manager_id', '=', user.employee_id.id)] + + + - - - - - - - - - - - + + Show Visit Location Created or Assigned (Researcher) + + [ + '|', + ('create_uid','=',user.id), + ('researcher_team.employee_id', 'in', user.employee_id.ids) + ] + + + - - - - - - - - + + + Show All Family Complaints + + [(1, '=', 1)] + + + - - - - - - - + + Show Family Complaints of Own Branch + + [('branch_custom_id.branch.manager_id', '=', user.employee_id.id)] + + + - - - - - - - + + Show Family Complaints of Assigned Branch (Operation Manager) + + [('branch_custom_id.branch.operation_manager_id', '=', user.employee_id.id)] + + + - - - - - - - - - - - + + Show Family Complaints Created or Assigned (Researcher) + + [ + '|', + ('create_uid','=',user.id), + ('researcher_id.employee_id', 'in', user.employee_id.ids) + ] + + + @@ -256,22 +252,5 @@ - - - - - - - - - - - - - - - - - diff --git a/odex25_ensan/odex_benefit/views/benefit_view.xml b/odex25_ensan/odex_benefit/views/benefit_view.xml index ab23f7d45..f783ba3a4 100644 --- a/odex25_ensan/odex_benefit/views/benefit_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_view.xml @@ -213,10 +213,10 @@ - - - - + + + +
@@ -230,13 +230,6 @@ - - - @@ -314,9 +307,6 @@ groups="!odex_benefit.group_benefit_manager"/> - - @@ -867,7 +857,7 @@