Merge pull request #6144 from expsa/you_benefit

You benefit
This commit is contained in:
kchyounes19 2026-01-12 10:14:09 +01:00 committed by GitHub
commit 8368b91c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 11 deletions

View File

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

View File

@ -364,7 +364,7 @@
<br/>
<field name="estimated_rent_amount"/>
<field name="estimated_rent_amount_payment"/>
<field name="added_amount_if_mother_dead"
<field name="added_amount_if_mother_dead" force_save="1"
attrs="{'invisible':[('service_type','=','alternative_housing')]}"/>
</group>
</group>

View File

@ -37,7 +37,7 @@
<field name="max_amount"
attrs="{'invisible': [('max_limit_type', '!=', 'fixed')]}"/>
<field name="raise_amount_for_orphan"
attrs="{'invisible':['|',('service_type','!=','rent'),('benefit_type','!=','member')]}"/>
attrs="{'invisible':['|',('service_type','!=','rent'),('benefit_type','!=','family')]}"/>
<field name="min_count_member"
attrs="{'invisible':[('service_type','!=','buy_car')]}"/>
<field name="buy_home_max_total_amount"