diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2015-03-04 14:00:42 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-03-09 16:20:36 +0100 |
| commit | 2cc09e86afad709cc13e3a686afb0687b4752b3f (patch) | |
| tree | ef032da73be4544b6268cfeb857b3341e1a1822e /addons/web/static/src/js/view_form.js | |
| parent | 209ce6f48c75fe91e79d7b54d981dcea9a7d3a8c (diff) | |
[FIX] web: on_change event on one2many fields was not fired if an attribute is mandatory (courtesy of Christophe Matthieu)
opw: 626974
Diffstat (limited to 'addons/web/static/src/js/view_form.js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1eef15a051b..52065001693 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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); } |
