[IMP] odex_benefit: IMP benefit

This commit is contained in:
younes 2026-01-12 10:11:51 +01:00
parent ac6b017b22
commit 711b6eefa0
4 changed files with 16 additions and 12 deletions

View File

@ -2080,7 +2080,7 @@ class GrantBenefitProfile(models.Model):
for rec in self: for rec in self:
rec.expenses_ids = False rec.expenses_ids = False
for expenses in rec.benefit_category_id: for expenses in rec.benefit_category_id:
if expenses.state == 'second_pprove': if expenses.state == 'second_approve':
for i in expenses.expenses_ids: for i in expenses.expenses_ids:
expenses = {} expenses = {}
expenses['expenses_type'] = i.expenses_type expenses['expenses_type'] = i.expenses_type

View File

@ -79,7 +79,7 @@ class ServiceRequest(models.Model):
start = fields.Date(string="Start Date") start = fields.Date(string="Start Date")
end = fields.Date(string='End Date') end = fields.Date(string='End Date')
added_amount_if_mother_dead = fields.Float(string="Added Amount (If mother dead)", 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( attachment_lines = fields.One2many(
'service.attachments.settings', 'service.attachments.settings',
'service_request_id', 'service_request_id',
@ -510,12 +510,6 @@ class ServiceRequest(models.Model):
rec.payment_type = False rec.payment_type = False
rec.rent_attachment = [(5, 0, 0)] 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): def _get_aid_amount(self):
for rec in self: for rec in self:
if rec.service_type == 'rent': if rec.service_type == 'rent':
@ -1043,7 +1037,7 @@ class ServiceRequest(models.Model):
lambda lambda
x: x.min_count_member <= rec.benefit_member_count <= x.max_count_member)).amount or 0 x: x.min_count_member <= rec.benefit_member_count <= x.max_count_member)).amount or 0
elif max_limit_type == 'region': 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: if rec.max_limit_period:
period_domain = base_domain.copy() period_domain = base_domain.copy()
@ -1065,7 +1059,7 @@ class ServiceRequest(models.Model):
rec.service_max_amount *= num_months rec.service_max_amount *= num_months
if service_type == 'rent': if service_type == 'rent':
rec.requested_service_amount = min(rec.rent_amount_payment, 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": elif rec.max_limit_period == "calendar_year":
current_date = rec.date.date() if isinstance(rec.date, datetime) else rec.date current_date = rec.date.date() if isinstance(rec.date, datetime) else rec.date
allowed_years = rec.service_cat.allowed_period or 1 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) rec.rent_amount_payment = rec.rent_amount * 12 / int(rec.payment_type)
else: else:
rec.rent_amount_payment = 0.0 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/> <br/>
<field name="estimated_rent_amount"/> <field name="estimated_rent_amount"/>
<field name="estimated_rent_amount_payment"/> <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')]}"/> attrs="{'invisible':[('service_type','=','alternative_housing')]}"/>
</group> </group>
</group> </group>

View File

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