From a3271fa6633b3ff771247fb0df8aa28401c92881 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 4 Apr 2017 11:59:54 +0200 Subject: [FIX] web: formview button context should be given to actions When clicking on a stat button in a form view, an action is executed. The button might also be given a context which have to be used when running the action. This context was ignored since the context refactoring made with commit 26a7fe7de1b6258989bc63335321f8f8e83435af. --- addons/web/static/src/js/views/basic/basic_model.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 5f934ea4e65..dc0beb96942 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1714,6 +1714,8 @@ var BasicModel = AbstractModel.extend({ * * @param {Object} element an element from the localData * @param {Object} [options] + * @param {string|Object} [options.additionalContext] + * another context to evaluate and merge to the returned context * @param {string} [options.fieldName] * the name of the field whose context needs to be added to the * result (and evaluated) @@ -1723,6 +1725,9 @@ var BasicModel = AbstractModel.extend({ var context = new Context(session.user_context, element.context); context.set_eval_context(this._getEvalContext(element)); + if (options && options.additionalContext) { + context.add(options.additionalContext); + } if (options && options.fieldName) { var viewType = options.viewType || element.viewType; var fieldInfo = element.fieldsInfo[viewType][options.fieldName]; -- cgit v1.2.3