From bcd34e83b7c79c198bbe2913231ca7bb39c44e8f Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Tue, 12 Jun 2018 15:29:13 +0200 Subject: [PATCH] [FIX] sale_timesheet: fix view mode Actions returned by the plan project are directly executed by the webclient. But their are not post processed like other actions by /web/action, so the 'fix_view_mode' method is not call, and this causes a mismatch between 'list' and 'tree' mode and type on action. This 'hack' is a bad legacy of the past ... --- addons/sale_timesheet/controllers/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/sale_timesheet/controllers/main.py b/addons/sale_timesheet/controllers/main.py index c2e51c9d7c3..975c8543785 100644 --- a/addons/sale_timesheet/controllers/main.py +++ b/addons/sale_timesheet/controllers/main.py @@ -9,6 +9,8 @@ from odoo import http, fields, _ from odoo.http import request from odoo.tools import float_round +from odoo.addons.web.controllers.main import clean_action + DEFAULT_MONTH_RANGE = 3 @@ -394,7 +396,7 @@ class SaleTimesheetController(http.Controller): 'type': 'ir.actions.act_window', 'res_model': res_model, 'view_mode': 'tree,form', - 'view_type': 'tree', + 'view_type': 'form', 'views': [[ts_view_tree_id, 'list'], [ts_view_form_id, 'form']], 'domain': domain, } @@ -410,9 +412,9 @@ class SaleTimesheetController(http.Controller): if len(tasks.mapped('project_id')) == 1: action['context']['default_project_id'] = tasks.mapped('project_id')[0].id elif res_model == 'sale.order': - action = request.env.ref('sale.action_orders').read()[0] + action = clean_action(request.env.ref('sale.action_orders').read()[0]) action['domain'] = domain elif res_model == 'account.invoice': - action = request.env.ref('account.action_invoice_tree1').read()[0] + action = clean_action(request.env.ref('account.action_invoice_tree1').read()[0]) action['domain'] = domain return action