From abf60775abeeacc1630b8cf674d2ddd2dfca6b9b Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Wed, 2 Mar 2022 15:13:46 +0000 Subject: [PATCH] [IMP] hr_contract: enable studio from contract history Previously when going to a contract from the contract history, studio was disabled, because it could not find a action xml id attached. TaskId- closes odoo/odoo#85690 Signed-off-by: Kevin Baptiste --- addons/hr_contract/models/hr_contract.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/hr_contract/models/hr_contract.py b/addons/hr_contract/models/hr_contract.py index dd7e22b297f..7b3492cc3b0 100644 --- a/addons/hr_contract/models/hr_contract.py +++ b/addons/hr_contract/models/hr_contract.py @@ -249,9 +249,11 @@ class Contract(models.Model): def action_open_contract_form(self): self.ensure_one() - return { - "type": "ir.actions.act_window", - "res_model": "hr.contract", - "views": [[False, "form"]], - "res_id": self.id, - } + action = self.env['ir.actions.actions']._for_xml_id('hr_contract.action_hr_contract') + action.update({ + 'view_mode': 'form', + 'view_id': self.env.ref('hr_contract.hr_contract_view_form').id, + 'views': [(self.env.ref('hr_contract.hr_contract_view_form').id, 'form')], + 'res_id': self.id, + }) + return action