[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
This commit is contained in:
parent
66afff1b52
commit
28cbfd22b7
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue