From 9322b677aa7848ab6ece42786f46137ff7eea05c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 10 Dec 2013 13:47:55 +0100 Subject: [PATCH] [FIX] weird behavior when drag&dropping a row during edition in editable listview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- addons/web/static/src/js/view_list_editable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index f00296eec40..f2fd8974d81 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -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'); }); },