[UPD] odex_benefit_project: change fields with the new logic
This commit is contained in:
parent
c1e49cb77d
commit
f2298b864b
|
|
@ -33,7 +33,18 @@ class ServiceRequestInherit(models.Model):
|
||||||
)
|
)
|
||||||
rec.project_id = project
|
rec.project_id = project
|
||||||
|
|
||||||
@api.onchange('requested_service_amount', 'benefit_type', 'date', 'service_cat','family_id','device_id','exception_or_steal','home_furnishing_exception','rent_period','has_marriage_course','member_id','home_age')
|
@api.onchange(
|
||||||
|
'requested_service_amount',
|
||||||
|
'benefit_type',
|
||||||
|
'date',
|
||||||
|
'service_cat',
|
||||||
|
'family_id',
|
||||||
|
'exception_or_steal',
|
||||||
|
'home_furnishing_exception',
|
||||||
|
'has_marriage_course',
|
||||||
|
'home_age',
|
||||||
|
'service_reason_id'
|
||||||
|
)
|
||||||
def onchange_requested_service_amount(self):
|
def onchange_requested_service_amount(self):
|
||||||
res = {}
|
res = {}
|
||||||
today = fields.Date.today()
|
today = fields.Date.today()
|
||||||
|
|
@ -245,34 +256,13 @@ class ServiceRequestInherit(models.Model):
|
||||||
return res
|
return res
|
||||||
# Validation for 'family' benefit type with 'transportation_insurance' service type
|
# Validation for 'family' benefit type with 'transportation_insurance' service type
|
||||||
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'transportation_insurance':
|
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'transportation_insurance':
|
||||||
if rec.service_reason == 'government_transportation':
|
if rec.service_reason_id and rec.requested_service_amount > rec.max_amount:
|
||||||
if rec.requested_service_amount > rec.max_government_transportation_amount:
|
self.benefit_type = False
|
||||||
self.benefit_type = False
|
res['warning'] = {
|
||||||
res['warning'] = {'title': _('ValidationError'),
|
'title': _('ValidationError'),
|
||||||
'message': _(
|
'message': _("You cannot request more than %s") % rec.max_amount
|
||||||
"You cannot request more than %s") % rec.max_government_transportation_amount}
|
}
|
||||||
return res
|
return res
|
||||||
if rec.service_reason == 'universities_training_institutes_transportation':
|
|
||||||
if rec.requested_service_amount > rec.max_universities_training_institutes_transportation_amount:
|
|
||||||
self.benefit_type = False
|
|
||||||
res['warning'] = {'title': _('ValidationError'),
|
|
||||||
'message': _(
|
|
||||||
"You cannot request more than %s") % rec.max_universities_training_institutes_transportation_amount}
|
|
||||||
return res
|
|
||||||
if rec.service_reason == 'hospitals_transportation':
|
|
||||||
if rec.requested_service_amount > rec.max_hospitals_transportation_amount:
|
|
||||||
self.benefit_type = False
|
|
||||||
res['warning'] = {'title': _('ValidationError'),
|
|
||||||
'message': _(
|
|
||||||
"You cannot request more than %s") % rec.max_hospitals_transportation_amount}
|
|
||||||
return res
|
|
||||||
if rec.service_reason == 'programs_transportation':
|
|
||||||
if rec.requested_service_amount > rec.max_programs_transportation_amount:
|
|
||||||
self.benefit_type = False
|
|
||||||
res['warning'] = {'title': _('ValidationError'),
|
|
||||||
'message': _(
|
|
||||||
"You cannot request more than %s") % rec.max_hospitals_transportation_amount}
|
|
||||||
return res
|
|
||||||
# Validation for 'family' benefit type with 'recruiting_driver' service type
|
# Validation for 'family' benefit type with 'recruiting_driver' service type
|
||||||
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'debits':
|
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'debits':
|
||||||
if rec.requested_service_amount > rec.service_cat.max_debits_amount:
|
if rec.requested_service_amount > rec.service_cat.max_debits_amount:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue