diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-01-20 16:24:09 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-01-23 09:19:49 +0100 |
| commit | 68dd9bdb0a5eb2eaff897cb652e701e0ee03bdd1 (patch) | |
| tree | a4fbb5a92487211b5bed61966ce9734da55bd9e2 | |
| parent | 4169049263555ab21ec6203d4d8402e16c7372aa (diff) | |
[FIX] board: prevent crash if no action
If the user tries to save on the dashboard a view which was not open
through an existing action, the call to method `add_to_dashboard`
crashes because of incorrect arguments (`action_id` is undefined in JS).
This is for example the case when trying to save an "Inventory at Date"
in the dashboard (will be fixed in a subsequent commit).
opw-703649
| -rw-r--r-- | addons/board/controllers.py | 2 | ||||
| -rw-r--r-- | addons/board/static/src/js/dashboard.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/board/controllers.py b/addons/board/controllers.py index 6eb0890ea46..f0486f59736 100644 --- a/addons/board/controllers.py +++ b/addons/board/controllers.py @@ -13,7 +13,7 @@ class Board(Controller): # Retrieve the 'My Dashboard' action from its xmlid action = request.env['ir.model.data'].get_object('board', 'open_board_my_dash_action') - if action and action['res_model'] == 'board.board' and action['views'][0][1] == 'form': + if action and action['res_model'] == 'board.board' and action['views'][0][1] == 'form' and action_id: # Maybe should check the content instead of model board.board ? view_id = action['views'][0][0] board = request.env[action['res_model']].fields_view_get(view_id, 'form') diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 1d543f1216c..10818ef20a5 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -405,7 +405,7 @@ FavoriteMenu.include({ name = self.$add_dashboard_input.val(); return self.rpc('/board/add_to_dashboard', { - action_id: self.action_id, + action_id: self.action_id || false, context_to_save: c, domain: d, view_mode: self.view_manager.active_view.type, |
