diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-08-09 09:21:13 +0200 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2017-08-10 08:48:32 +0200 |
| commit | 1e8f6d01ffe324348ce5d75f8643f170f6478657 (patch) | |
| tree | f833ee666fa709fdae4f3de1824733c6e638f4f4 /addons/web/static/src/js/views/basic | |
| parent | 50957038b9ebe5e249da28a9745f957ad02a0760 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_controller.js | 12 |
1 files changed, 8 insertions, 4 deletions
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); |
