[IMP] web: remove needless o2m onchange

Partial backport of master (-> v9) commit 059230512.

for the issue when removing an invoice line from an account.invoice,
three onchange where triggered:

- ListView account.invoice.line unlink the line id from its dataset,
  [[first onchange]]
  -> the line id is removed from the dataset which trigger an onchange

after this is done (and the onchange is finished), the following
onchange happen:

-- remove each record of the Collection of the ListView
   -> this remove the id of these record from the ListView List dataset
      [[second onchange]]
      -> this trigger an onchange albeit the dataset is not changed
         (since it was already removed before the first onchange)
   -> this trigger an onchange on the one2many_list of the ListView
      which has the same dataset as the ListView
      [[third onchange]]
      -> so an onchange is called yet again.

this commit removes the second onchange in this case where we remove ids
already removed from the dataset.

closes #8273
fixes #7595
opw-644706
This commit is contained in:
Nicolas Lempereur 2015-08-28 09:45:06 +02:00
parent c333385eda
commit 3e1d5a5cca
1 changed files with 4 additions and 1 deletions

View File

@ -1047,8 +1047,11 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
return this._super(id, signal);
},
alter_ids: function(n_ids) {
var dirty = !_.isEqual(this.ids, n_ids);
this._super(n_ids);
this.trigger("dataset_changed", n_ids);
if(dirty) {
this.trigger("dataset_changed", n_ids);
}
},
});
instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/;