[IMP] odex_benefit: IMP Benefit
This commit is contained in:
parent
68c4c924a6
commit
c813947614
|
|
@ -293,6 +293,8 @@ class FamilyMemberProfile(models.Model):
|
|||
resume_date = fields.Date(string="Return Date")
|
||||
resume_notes = fields.Text(string="Return Notes")
|
||||
exit_benefit_date = fields.Date(string="Exit Benefit Date")
|
||||
can_request_temporary_exception = fields.Boolean(string="Can Request Temporary Exception",
|
||||
compute='_compute_can_request_temporary_exception', )
|
||||
|
||||
# def create(self, vals):
|
||||
# for line_vals in vals:
|
||||
|
|
@ -343,6 +345,31 @@ class FamilyMemberProfile(models.Model):
|
|||
rec.last_education_levels = False
|
||||
rec.case_study = False
|
||||
|
||||
@api.depends(
|
||||
'relationn.relation_type',
|
||||
'case_study',
|
||||
'age',
|
||||
'benefit_id',
|
||||
)
|
||||
def _compute_can_request_temporary_exception(self):
|
||||
settings = self.env["family.validation.setting"].search([], limit=1)
|
||||
|
||||
exceptional_age_scientific = (
|
||||
settings.exceptional_age_scientific_specialty
|
||||
if settings else 22
|
||||
)
|
||||
|
||||
for rec in self:
|
||||
if not rec.relationn:
|
||||
rec.can_request_temporary_exception = False
|
||||
continue
|
||||
|
||||
is_son = rec.relationn.relation_type == 'son'
|
||||
is_continuous = rec.case_study == 'continuous'
|
||||
old_enough = (rec.age or 0) >= exceptional_age_scientific
|
||||
|
||||
rec.can_request_temporary_exception = is_son and is_continuous and old_enough
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
if self._context.get('members_domain_force_all'):
|
||||
|
|
@ -574,6 +601,7 @@ class FamilyMemberProfile(models.Model):
|
|||
'state',
|
||||
'is_dead',
|
||||
'is_work',
|
||||
'case_study',
|
||||
'benefit_id.member_ids.member_status',
|
||||
)
|
||||
def check_member_status(self):
|
||||
|
|
@ -1022,9 +1050,14 @@ class FamilyMemberProfile(models.Model):
|
|||
def action_exception_second_accept(self):
|
||||
for rec in self:
|
||||
rec.is_excluded_suspension = True
|
||||
rec.state_a = 'exception_second_approve'
|
||||
rec.state_a = 'family_services_manager'
|
||||
# rec.is_member_workflow = False
|
||||
|
||||
def action_exception_third_accept(self):
|
||||
for rec in self:
|
||||
rec.is_excluded_suspension = True
|
||||
rec.state_a = 'exception_second_approve'
|
||||
|
||||
def action_exception_final_accept(self):
|
||||
for rec in self:
|
||||
rec.is_excluded_suspension = True
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@
|
|||
<button name="action_exception" type="object"
|
||||
string="Temporarily Exception" class="oe_highlight"
|
||||
confirm="Are you sure you want to move to Temporarily Exception ?"
|
||||
groups="!odex_benefit.group_benefit_supervisor"
|
||||
attrs="{'invisible': ['|','|',('action_type','=','exception'),('member_status','=','benefit'),('can_request_temporary_exception','=',False)]}"/>
|
||||
<button name="action_exception" type="object"
|
||||
string="Temporarily Exception" class="oe_highlight"
|
||||
confirm="Are you sure you want to move to Temporarily Exception ?"
|
||||
groups="odex_benefit.group_benefit_supervisor"
|
||||
attrs="{'invisible': ['|',('action_type','=','exception'),('member_status','=','benefit')]}"/>
|
||||
<button name="action_exception_first_accept" type="object"
|
||||
string="Exception First Approve" class="oe_highlight"
|
||||
|
|
@ -66,13 +72,18 @@
|
|||
groups="odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"
|
||||
attrs="{'invisible': ['|',('action_type','!=','exception'),('state', 'not in', ['first_approve'])]}"
|
||||
/>
|
||||
<button name="action_exception_third_accept" type="object"
|
||||
string="Exception Family Services Manager Approve" class="oe_highlight"
|
||||
groups="odex_benefit.group_benefit_manager"
|
||||
attrs="{'invisible': ['|',('action_type','!=','exception'),('state', 'not in', ['family_services_manager'])]}"
|
||||
/>
|
||||
<button name="action_exception_final_accept" type="object"
|
||||
string="Exception Final Approve" class="oe_highlight"
|
||||
attrs="{'invisible': [('state','not in',['exception_second_approve'])]}"
|
||||
groups="odex_benefit.group_benefit_manager"/>
|
||||
<button name="action_exception_refuse" type="object"
|
||||
string="Exception Refuse" class="btn btn-danger"
|
||||
attrs="{'invisible': ['|',('action_type','!=','exception'),('state', 'not in', ['waiting_approve','first_approve','exception_second_approve'])]}"
|
||||
attrs="{'invisible': ['|',('action_type','!=','exception'),('state', 'not in', ['waiting_approve','first_approve','family_services_manager','exception_second_approve'])]}"
|
||||
/>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="draft,new,complete_info,waiting_approve,first_approve,second_approve"/>
|
||||
|
|
@ -195,12 +206,13 @@
|
|||
attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
|
||||
<field name="last_education_levels"
|
||||
attrs="{'invisible':[('education_status','!=','educated')]}"/>
|
||||
<field name="case_study"
|
||||
<field name="case_study" force_save="1"
|
||||
attrs="{'invisible':[('education_status','!=','educated')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="can_request_temporary_exception" invisible="1"/>
|
||||
<field name="sponsor_related_id"
|
||||
readonly="1"/>
|
||||
<field name="sponsor_id"
|
||||
|
|
|
|||
Loading…
Reference in New Issue