From 2939800ed438505be9c919d4edca0ce624e6bf8e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 8 Dec 2015 15:04:35 +0100 Subject: [PATCH] [FIX] web: char_domain widget re-renders on model change Before this revision, the `char_domain` re-rendered its display only when its domain value was changed. It must re-render as well when the model on which this domain is applied is changed, as the number of records can obviously be different. e.g., in mass-mailing, when changing the recipients type from partners to leads, the domain doesn't change, it stays `['opt_out', '=', False]`, but the model on which this domain is applied does change, as well as the number of selected records. opw-658391 --- addons/web/static/src/js/view_form.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e660d31292e..2766b9bb5e6 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2566,6 +2566,15 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta this.on("change:effective_readonly", this, function () { this.display_field(); }); + if (this.options.model_field){ + this.field_manager.fields[this.options.model_field].on("change:value", this, function(){ + if (self.view && self.view.onchanges_mutex){ + self.view.onchanges_mutex.def.then(function(){ + self.display_field(); + }); + } + }); + } this.display_field(); return this._super(); },