[FIX] rare problem during save

bzr revid: nicolas.vanhoren@openerp.com-20120720141304-dpmw02lx7u2ureia
This commit is contained in:
niv-openerp 2012-07-20 16:13:04 +02:00
parent 365cb62845
commit ec3ff22aed
1 changed files with 3 additions and 8 deletions

View File

@ -80,7 +80,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.reload_mutex = new $.Mutex(); this.reload_mutex = new $.Mutex();
this.__clicked_inside = false; this.__clicked_inside = false;
this.__blur_timeout = null; this.__blur_timeout = null;
this.rendering_engine = new instance.web.form.FormRenderingEngineReadonly(this); this.rendering_engine = new instance.web.form.FormRenderingEngine(this);
this.qweb = null; // A QWeb instance will be created if the view is a QWeb template this.qweb = null; // A QWeb instance will be created if the view is a QWeb template
}, },
destroy: function() { destroy: function() {
@ -680,7 +680,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
if (!first_invalid_field) { if (!first_invalid_field) {
first_invalid_field = f; first_invalid_field = f;
} }
} else if (f.name !== 'id' && !f.get("readonly") && (!self.datarecord.id || f._dirty_flag)) { } else if (f.name !== 'id' && (!self.datarecord.id || (!f.get("readonly") && f._dirty_flag))) {
// Special case 'id' field, do not save this field // Special case 'id' field, do not save this field
// on 'create' : save all non readonly fields // on 'create' : save all non readonly fields
// on 'edit' : save non readonly modified fields // on 'edit' : save non readonly modified fields
@ -1347,12 +1347,6 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
}, },
}); });
instance.web.form.FormRenderingEngineReadonly = instance.web.form.FormRenderingEngine.extend({
alter_field: function(field) {
field.set({"force_readonly": true});
},
});
instance.web.form.FormDialog = instance.web.Dialog.extend({ instance.web.form.FormDialog = instance.web.Dialog.extend({
init: function(parent, options, view_id, dataset) { init: function(parent, options, view_id, dataset) {
this._super(parent, options); this._super(parent, options);
@ -1813,6 +1807,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
// some events to make the property "effective_readonly" sync automatically with "readonly" and // some events to make the property "effective_readonly" sync automatically with "readonly" and
// "force_readonly" // "force_readonly"
this.set({"readonly": this.modifiers['readonly'] === true}); this.set({"readonly": this.modifiers['readonly'] === true});
this.set({"force_readonly": false});
var test_effective_readonly = function() { var test_effective_readonly = function() {
this.set({"effective_readonly": this.get("readonly") || !!this.get("force_readonly")}); this.set({"effective_readonly": this.get("readonly") || !!this.get("force_readonly")});
}; };