summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2017-10-19 16:42:25 +0200
committerChristophe Matthieu <chm@odoo.com>2017-10-23 12:18:28 +0200
commit512113b78ad4b6c1fb59c313ec73f6c4a04f8737 (patch)
tree216d5c7bf31e081386a074d5eac74a1ec93f2cc2 /addons/web/static/src/js/views/basic/basic_model.js
parentdc2a6c6cd2a281b7d9e5d33d8e37d2f6b15d7e78 (diff)
[FIX] web: reordering lines using the handle widget triggers onchange
issue: When reorder each line trigger an onchange on the line (if they are an onchange linked to the field) and one onchange per line on the parent. Adding an option doNotNotifyChange to avoid the trigger on the parent.
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.js7
1 files changed, 7 insertions, 0 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 717dcc9f6af..50cd7165a82 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1092,6 +1092,9 @@ var BasicModel = AbstractModel.extend({
* @param {boolean} [options.doNotSetDirty=false] if this flag is set to
* true, then we will not tag the record as dirty. This should be avoided
* for most situations.
+ * @param {boolean} [options.notifyChange=true] if this flag is set to
+ * false, then we will not notify and not trigger the onchange, even though
+ * it was changed.
* @param {string} [options.viewType] current viewType. If not set, we will assume
* main viewType from the record
* @returns {Deferred}
@@ -1119,6 +1122,10 @@ var BasicModel = AbstractModel.extend({
}
}
+ if (options.notifyChange === false) {
+ return $.when();
+ }
+
return $.when.apply($, defs).then(function () {
var onChangeFields = []; // the fields that have changed and that have an on_change
for (var fieldName in changes) {