[FIX] web: on_change event on one2many fields was not fired if an attribute is mandatory (courtesy of Christophe Matthieu)

opw: 626974
This commit is contained in:
Nicolas Martinelli 2015-03-04 14:00:42 +01:00 committed by Christophe Matthieu
parent 209ce6f48c
commit 2cc09e86af
1 changed files with 4 additions and 6 deletions

View File

@ -3873,8 +3873,8 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
this.records
.bind('add', this.proxy("changed_records"))
.bind('edit', this.proxy("changed_records"))
.bind('remove', this.proxy("changed_records"));
this.on('save:after', this, this.proxy("changed_records"));
},
start: function () {
var ret = this._super();
@ -3891,7 +3891,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
if (!this.fields_view || !this.editable()){
return true;
}
var r;
if (_.isEmpty(this.records.records)){
return true;
}
@ -3902,9 +3901,8 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
current_values[field.name] = field.get('value');
});
var valid = _.every(this.records.records, function(record){
r = record;
_.each(self.editor.form.fields, function(field){
field.set_value(r.attributes[field.name]);
field.set_value(record.attributes[field.name]);
});
return _.every(self.editor.form.fields, function(field){
field.process_modifiers();
@ -5477,11 +5475,11 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
calc_domain: function() {
var d = instance.web.pyeval.eval('domain', this.build_domain());
var domain = []; //if there is no domain defined, fetch all the records
if (d.length) {
domain = ['|',['id', '=', this.get('value')]].concat(d);
}
if (! _.isEqual(domain, this.get("evaluated_selection_domain"))) {
this.set("evaluated_selection_domain", domain);
}