diff --git a/odex25_benefit/odex_benefit/models/service_request.py b/odex25_benefit/odex_benefit/models/service_request.py
index bc1f11f08..9464d8d5d 100644
--- a/odex25_benefit/odex_benefit/models/service_request.py
+++ b/odex25_benefit/odex_benefit/models/service_request.py
@@ -79,7 +79,7 @@ class ServiceRequest(models.Model):
start = fields.Date(string="Start Date")
end = fields.Date(string='End Date')
added_amount_if_mother_dead = fields.Float(string="Added Amount (If mother dead)",
- compute="_get_added_amount_if_mother_dead")
+ compute="_get_added_amount_if_mother_dead",store=True)
attachment_lines = fields.One2many(
'service.attachments.settings',
'service_request_id',
@@ -510,12 +510,6 @@ class ServiceRequest(models.Model):
rec.payment_type = False
rec.rent_attachment = [(5, 0, 0)]
- def _get_added_amount_if_mother_dead(self):
- for rec in self:
- rec.added_amount_if_mother_dead = 0.0
- if rec.family_id.mother_marital_conf.is_dead:
- rec.added_amount_if_mother_dead = rec.service_cat.raise_amount_for_orphan
-
def _get_aid_amount(self):
for rec in self:
if rec.service_type == 'rent':
@@ -1043,7 +1037,7 @@ class ServiceRequest(models.Model):
lambda
x: x.min_count_member <= rec.benefit_member_count <= x.max_count_member)).amount or 0
elif max_limit_type == 'region':
- rec.service_max_amount = rec.estimated_rent_amount / 12
+ rec.service_max_amount = rec.estimated_rent_amount / 12 + rec.added_amount_if_mother_dead
if rec.max_limit_period:
period_domain = base_domain.copy()
@@ -1065,7 +1059,7 @@ class ServiceRequest(models.Model):
rec.service_max_amount *= num_months
if service_type == 'rent':
rec.requested_service_amount = min(rec.rent_amount_payment,
- rec.estimated_rent_amount_payment)
+ rec.estimated_rent_amount_payment) + rec.added_amount_if_mother_dead
elif rec.max_limit_period == "calendar_year":
current_date = rec.date.date() if isinstance(rec.date, datetime) else rec.date
allowed_years = rec.service_cat.allowed_period or 1
@@ -1347,3 +1341,13 @@ class ServiceRequest(models.Model):
rec.rent_amount_payment = rec.rent_amount * 12 / int(rec.payment_type)
else:
rec.rent_amount_payment = 0.0
+
+ @api.depends('family_id','service_cat','payment_type')
+ def _get_added_amount_if_mother_dead(self):
+ for rec in self:
+ added_amount_if_mother_dead = 0.0
+ if rec.family_id.mother_marital_conf.is_dead:
+ added_amount_if_mother_dead = rec.service_cat.raise_amount_for_orphan
+ if rec.service_cat.raise_amount_for_orphan and rec.payment_type:
+ added_amount_if_mother_dead = rec.service_cat.raise_amount_for_orphan / int(rec.payment_type)
+ rec.added_amount_if_mother_dead = added_amount_if_mother_dead
\ No newline at end of file
diff --git a/odex25_benefit/odex_benefit/views/service_request.xml b/odex25_benefit/odex_benefit/views/service_request.xml
index 456ddea02..fe95e442b 100644
--- a/odex25_benefit/odex_benefit/views/service_request.xml
+++ b/odex25_benefit/odex_benefit/views/service_request.xml
@@ -364,7 +364,7 @@
-
diff --git a/odex25_benefit/odex_benefit/views/services_settings.xml b/odex25_benefit/odex_benefit/views/services_settings.xml
index c7e934fac..39a1dbc1d 100644
--- a/odex25_benefit/odex_benefit/views/services_settings.xml
+++ b/odex25_benefit/odex_benefit/views/services_settings.xml
@@ -37,7 +37,7 @@
+ attrs="{'invisible':['|',('service_type','!=','rent'),('benefit_type','!=','family')]}"/>