summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-09-24 13:51:41 +0200
committerChristophe Matthieu <chm@odoo.com>2015-09-24 14:13:55 +0200
commit7e8fa2aac58af79909204f02e75eda04df23b27d (patch)
treeee0887b6c903ea3c98b21279f37b5cee956e4e61 /addons/web/static/src
parent19dfde855841cce17b86322c92abd78359ba6a0f (diff)
[FIX] web: trigger onchange only once when write re-order sequences
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list_view.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js
index 095e79eb6ee..20ac68b1439 100644
--- a/addons/web/static/src/js/views/list_view.js
+++ b/addons/web/static/src/js/views/list_view.js
@@ -1642,23 +1642,25 @@ ListView.Groups = Class.extend( /** @lends instance.web.ListView.Groups# */{
// if drag to 1st row (to = 0), start sequencing from 0
// (exclusive lower bound)
seq = to ? list.records.at(to - 1).get(seqname) : 0;
+ var defs = [];
var fct = function (dataset, id, seq) {
- $.async_when().done(function () {
+ defs.push($.async_when().then(function () {
var attrs = {};
attrs[seqname] = seq;
- dataset.write(id, attrs);
- });
+ return dataset.write(id, attrs, {internal_dataset_changed: true});
+ }));
};
while (++seq, (record = list.records.at(index++))) {
// write are independent from one another, so we can just
// launch them all at the same time and we don't really
// give a fig about when they're done
- // FIXME: breaks on o2ms (e.g. Accounting > Financial
- // Accounting > Taxes > Taxes, child tax accounts)
- // when synchronous (without setTimeout)
fct(dataset, record.get('id'), seq);
record.set(seqname, seq);
}
+ $.when.apply($, defs).then(function () {
+ // use internal_dataset_changed and trigger one onchange after all writes
+ dataset.trigger("dataset_changed");
+ });
}
});
},