[FIX] defer actually writing the resequencing of a list view to the backing dataset ~/projects/tiny/web/current

There seems to be an issue with synchronous o2m writes doing weird
things (records disappear after being drag & dropped)

lp bug: https://launchpad.net/bugs/900207 fixed

bzr revid: xmo@openerp.com-20111206082713-efq1w88sv0htl39c
This commit is contained in:
Xavier Morel 2011-12-06 09:27:13 +01:00
parent 255cfb94b0
commit 0fbdaab88f
1 changed files with 8 additions and 1 deletions

View File

@ -1296,7 +1296,14 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L
// 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
dataset.write(record.get('id'), {sequence: seq});
// FIXME: breaks on o2ms (e.g. Accounting > Financial
// Accounting > Taxes > Taxes, child tax accounts)
// when synchronous (without setTimeout)
(function (dataset, id, seq) {
setTimeout(function () {
dataset.write(id, {sequence: seq});
}, 0);
}(dataset, record.get('id'), seq));
record.set('sequence', seq);
}