diff options
| author | Xavier Morel <xmo@openerp.com> | 2012-11-19 09:42:03 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2012-11-19 09:42:03 +0100 |
| commit | 28cbfd22b782198db100fd4eb40d95cf9c3a1fd0 (patch) | |
| tree | dfba269228014be4b25ef55d7d178585a0c6f2f7 /addons/web/static/src/js/view_list_editable.js | |
| parent | 66afff1b52b7ab6ab8c340e18960fb6367cfb714 (diff) | |
[FIX] editable listview: do not attempt to delete falsy ids (from the dataset)
During the creation of a new record (in an editable list), the
prospective new record has a ``false`` id. In a non-o2m, the row under
creation can be selected (checkbox) and deleted (More > Delete),
leading to the request to ``DELETE false`` being sent to the ORM…
which said ORM does not wish to entertain.
Before actually performing the delete request (more precisely
forwarding said request to the listview itself), remove all false-ish
ids from the array.
Also, don't send a request to delete nothing.
bzr revid: xmo@openerp.com-20121119084203-0vz4v9myfizxz88u
Diffstat (limited to 'addons/web/static/src/js/view_list_editable.js')
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 1abe3caab39..c42f79d57f9 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -78,12 +78,16 @@ openerp.web.list_editable = function (instance) { _.extend(this.dataset, dataset); }, do_delete: function (ids) { + var nonfalse = _.compact(ids); var _super = this._super.bind(this); var next = this.editor.is_editing() ? this.cancel_edition(true) : $.when(); return next.then(function () { - return _super(ids); + if (_.isEmpty(nonfalse)) { + return $.when(); + } + return _super(nonfalse); }); }, editable: function () { |
