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 @@
-
+
-
+