[FIX] web: assertion error when save after speed multi delete in one2many

To reproduce use a form view with a one2many editable list and create a lot of lines. Then click a few times quickly on the delete.
If the user click at least two times on delete of a same record, the dataset add the id in "to_delete" the virtual id because "to_create" doesn't contains the virtual id of the record deleted previously.

E.g.: create a "Customer Payments" and select a "Customer" and "Payment Method" who generate a lot of "Credits" lines.
This commit is contained in:
Christophe Matthieu 2015-10-12 16:08:42 +02:00 committed by Denis Ledoux
parent 1881a13699
commit 2f842d1703
1 changed files with 1 additions and 1 deletions

View File

@ -902,7 +902,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
unlink: function(ids, callback, error_callback) {
var self = this;
_.each(ids, function(id) {
if (! _.detect(self.to_create, function(x) { return x.id === id; })) {
if (! _.detect(self.to_create, function(x) { return x.id === id; }) && _.detect(self.cache, function(x) { return x.id === id; })) {
self.to_delete.push({id: id});
}
});