[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
This commit is contained in:
Denis Ledoux 2015-12-08 15:04:35 +01:00
parent 071144b0ac
commit 2939800ed4
1 changed files with 9 additions and 0 deletions

View File

@ -2566,6 +2566,15 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
this.on("change:effective_readonly", this, function () { this.on("change:effective_readonly", this, function () {
this.display_field(); 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(); this.display_field();
return this._super(); return this._super();
}, },