summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-07-18 11:33:09 +0200
committerDavid Monjoie <dmo@odoo.com>2017-07-18 15:59:48 +0200
commitefd158523438cebd96f9f2e7243873f222a97fea (patch)
tree072aa9561443b1e5b578dc933b84d458d78ba11b /addons/web/static/src/js
parent1ceb201d5e8221d5fb9e1059bede515a07c577c3 (diff)
[FIX] web: fix action context
Previously, we had to filter the context values to exclude some erroneous values we propagated earlier. This commit removes the earlier propagation of wrong values (the current record context when executing an action) and thus also removes the filtering of those values, which was actually removing useful values from the action context. The bug could be seen by following these steps: - Install crm and sale - Go to My Pipeline - Open an opportunity which has a customer set - Click on "New Quotation" action button - See that the customer is not set on the new quotation, it should be set by the default_partner_id value in the action context
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/chrome/view_manager.js3
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js6
2 files changed, 5 insertions, 4 deletions
diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js
index fcd823f440a..b6208df272d 100644
--- a/addons/web/static/src/js/chrome/view_manager.js
+++ b/addons/web/static/src/js/chrome/view_manager.js
@@ -568,10 +568,11 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
// Wrong default_* and search_default_* values will no give the expected result
// Wrong group_by values will simply fail and forbid rendering of the destination view
var ncontext = new Context(
- _.object(_.reject(_.pairs(_.extend({}, action_data.context, self.env.context)), function(pair) {
+ _.object(_.reject(_.pairs(self.env.context), function(pair) {
return pair[0].match('^(?:(?:default_|search_default_|show_).+|.+_view_ref|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
}))
);
+ ncontext.add(action_data.context || {});
ncontext.add({active_model: self.env.modelName});
if (res_ids) {
ncontext.add({
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 eead1b0aaed..75a0ad02971 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -2369,8 +2369,8 @@ var BasicModel = AbstractModel.extend({
* if given, this field's context is added to the context, instead of
* the element's context (except if options.full is true)
* @param {boolean} [options.full=false]
- * if true and fieldName given in options, the element's context
- * is added to the context
+ * if true or nor fieldName or additionalContext given in options,
+ * the element's context is added to the context
* @returns {Object} the evaluated context
*/
_getContext: function (element, options) {
@@ -2378,7 +2378,7 @@ var BasicModel = AbstractModel.extend({
var context = new Context(session.user_context);
context.set_eval_context(this._getEvalContext(element));
- if (options.full || !options.fieldName) {
+ if (options.full || !(options.fieldName || options.additionalContext)) {
context.add(element.context);
}
if (options.fieldName) {