From 1e8f6d01ffe324348ce5d75f8643f170f6478657 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 9 Aug 2017 09:21:13 +0200 Subject: [FIX] web,*: send correct context on button clicked *account_asset When a button of type 'action' is clicked (execute a given action), special keys must be set in the context (active_id, active_ids and active_model). They must be computed regarding the record containing the clicked button, i.e. if we are in a modal, it must be the id and model of the record displayed in the modal. Before this rev., we always sent the id and model of the record displayed in the background (i.e. the id and model of the url). This caused a bug in MRP that could be reproduced as follows: - open a manufacturing order in form view - click on edit - click on one of the line of the one2many, and click on the green icon to edit a product - click on the update product quantity button on top of it - the product field must be correctly filled, which was not the case before this rev. --- addons/web/static/src/js/views/basic/basic_controller.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_controller.js') diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 3a47f65ab03..6ba9dbea477 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -232,13 +232,17 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { return self.isDestroyed() ? $.when() : self.reload(); }; record = record || this.model.get(this.handle); - var recordID = record.data.id; + this.trigger_up('execute_action', { action_data: _.extend({}, attrs, { - context: record.getContext({additionalContext: attrs.context || {}}), + context: record.getContext({additionalContext: attrs.context || {}}), }), - model: record.model, - res_ids: [recordID], + env: { + context: record.getContext(), + currentID: record.data.id, + model: record.model, + resIDs: record.res_ids, + }, on_closed: function (reason) { if (!_.isObject(reason)) { reload(reason); -- cgit v1.2.3