[FIX] weird behavior when drag&dropping a row during edition in editable listview

When dropping, would simultanously stop the edition and try a write
(so 2 writes on the same record) and generally screw up the state of
all the things, ending up with an empty row and a weird (and
incorrect) warning.

This can be fixed by preventing resequencing during the creation or
edition of a record (row) inline.

For simplicity, implemented by looking up .ui-sortable descendants —
there are no utility methods for handling that and, aside from the
class, there's no good way to know if sortability was enabled on a
list body or not (as far as I can see, jquery-ui's sortable has no API
to query that) — and using jquery-ui's sortable API for enabling and
disabling sortable on the fly.

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

bzr revid: xmo@openerp.com-20131210124755-ugr3ehf744qoh1o5
This commit is contained in:
Xavier Morel 2013-12-10 13:47:55 +01:00
parent f5458a954d
commit 9322b677aa
1 changed files with 2 additions and 0 deletions

View File

@ -50,8 +50,10 @@ openerp.web.list_editable = function (instance) {
});
this.on('edit:after', this, function () {
self.$el.add(self.$buttons).addClass('oe_editing');
self.$('.ui-sortable').sortable('disable');
});
this.on('save:after cancel:after', this, function () {
self.$('.ui-sortable').sortable('enable');
self.$el.add(self.$buttons).removeClass('oe_editing');
});
},