[FIX] update_dom not called anymore on form changed

bzr revid: fme@openerp.com-20120319170336-2g7coyj92putcvuk
This commit is contained in:
Fabien Meghazi 2012-03-19 18:03:36 +01:00
parent 56516cc3bc
commit 5e1c895fae
1 changed files with 8 additions and 8 deletions

View File

@ -34,8 +34,6 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
this.model = dataset.model; this.model = dataset.model;
this.view_id = view_id || false; this.view_id = view_id || false;
this.fields_view = {}; this.fields_view = {};
this.widgets = {};
this.widgets_counter = 0;
this.fields = {}; this.fields = {};
this.fields_order = []; this.fields_order = [];
this.datarecord = {}; this.datarecord = {};
@ -80,7 +78,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
this.sidebar.attachments.destroy(); this.sidebar.attachments.destroy();
this.sidebar.destroy(); this.sidebar.destroy();
} }
_.each(this.widgets, function(w) { _.each(this.get_widgets(), function(w) {
w.destroy(); w.destroy();
}); });
this._super(); this._super();
@ -217,14 +215,13 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
}); });
}, },
on_form_changed: function() { on_form_changed: function() {
for (var w in this.widgets) { _.each(this.get_widgets(), function(w) {
w = this.widgets[w];
w.process_modifiers(); w.process_modifiers();
if (w.field) { if (w.field) {
w.validate(); w.validate();
} }
w.update_dom(); w.update_dom();
} });
}, },
do_notify_change: function() { do_notify_change: function() {
this.$element.addClass('oe_form_dirty'); this.$element.addClass('oe_form_dirty');
@ -603,6 +600,11 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
} }
}); });
}, },
get_widgets: function() {
return _.filter(this.getChildren(), function(obj) {
return obj instanceof openerp.web.form.Widget;
});
},
get_fields_values: function(blacklist) { get_fields_values: function(blacklist) {
blacklist = blacklist || []; blacklist = blacklist || [];
var values = {}; var values = {};
@ -3203,9 +3205,7 @@ openerp.web.form.FieldReference = openerp.web.form.AbstractField.extend(_.extend
this.get_selected_ids = view.get_selected_ids; this.get_selected_ids = view.get_selected_ids;
this.do_onchange = this.on_form_changed = this.do_notify_change = this.on_nop; this.do_onchange = this.on_form_changed = this.do_notify_change = this.on_nop;
this.dataset = this.view.dataset; this.dataset = this.view.dataset;
this.widgets_counter = 0;
this.view_id = 'reference_' + _.uniqueId(); this.view_id = 'reference_' + _.uniqueId();
this.widgets = {};
this.fields = {}; this.fields = {};
this.fields_order = []; this.fields_order = [];
this.reference_ready = true; this.reference_ready = true;