diff options
| author | jem-odoo <jem@openerp.com> | 2018-06-12 15:29:13 +0200 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2018-06-13 10:34:14 +0200 |
| commit | bcd34e83b7c79c198bbe2913231ca7bb39c44e8f (patch) | |
| tree | bdc0cfe88277877ad1ba89bf4bd8399a06289c1a | |
| parent | 4f04af5bab4200cd7e61a930f5db2f55e25fa80c (diff) | |
[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 ...
| -rw-r--r-- | addons/sale_timesheet/controllers/main.py | 8 |
1 files 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 |
