[IMP] hr_holidays: open corresponding record on Time Off Analysis
Add a button to directly open the leave/allocation in the Time Off Analysis view. closes odoo/odoo#84729 Taskid: 2762014 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -112,3 +112,13 @@ class LeaveReport(models.Model):
|
||||
'search_default_active_employee': True,
|
||||
}
|
||||
}
|
||||
|
||||
def action_open_record(self):
|
||||
self.ensure_one()
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_id': self.leave_id.id if self.leave_id else self.allocation_id.id,
|
||||
'res_model': 'hr.leave' if self.leave_id else 'hr.leave.allocation',
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<field name="model">hr.leave.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree create="0" edit="0" delete="0">
|
||||
<button name="action_open_record" type="object" icon="fa-external-link" title="Open" />
|
||||
<field name="employee_id" decoration-muted="not active_employee"/>
|
||||
<field name="number_of_days" string="Number of Days" sum="Remaining Days"/>
|
||||
<field name="leave_type"/>
|
||||
@@ -106,7 +107,7 @@
|
||||
<field name="model_id" ref="hr_holidays.model_hr_leave_report"/>
|
||||
<field name="binding_model_id" ref="hr.model_hr_employee"/>
|
||||
<field name="state">code</field>
|
||||
<field name="groups_id" eval="[(4, ref('base.group_user'))]"/>
|
||||
<field name="groups_id" eval="[(4, ref('hr_holidays.group_hr_holidays_user'))]"/>
|
||||
<field name="code">
|
||||
action = model.action_time_off_analysis()
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user