From 3e1d5a5cca105fdf1e2f6446fe48b3a76f3654cb Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 28 Aug 2015 09:45:06 +0200 Subject: [PATCH] [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 --- addons/web/static/src/js/data.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 74e161bd878..95cbf067cfb 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -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_.*$/;