summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-04-06 13:50:05 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit318ff5f00d288f2e5db49548cd5f86646d22edc4 (patch)
tree0d8950887472bd410324ea38fab399aec47d4d94 /addons/web/static/src/js/views/basic/basic_model.js
parent3dfa2caa3d455415d09a7e3051a0f5c1294ca5c1 (diff)
[FIX] web: pass context of changed field to onchange RPC
When a field with an onchange is changed, if there is a context defined on the field in the arch, this context must be added to the context sent with the onchange RPC.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js9
1 files changed, 6 insertions, 3 deletions
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 c95325dbb87..47ce8ad3780 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -861,12 +861,15 @@ var BasicModel = AbstractModel.extend({
var self = this;
var onchange_spec = this._buildOnchangeSpecs(record);
var idList = record.data.id ? [record.data.id] : [];
- var context = this._getContext(record);
- var currentData = this._generateOnChangeData(record);
-
+ var options = {};
if (fields.length === 1) {
fields = fields[0];
+ // if only one field changed, add its context to the RPC context
+ options.fieldName = fields;
}
+ var context = this._getContext(record, options);
+ var currentData = this._generateOnChangeData(record);
+
return self._rpc({
model: record.model,
method: 'onchange',