[fix] attempt to fix a race condition where a o2m will try to make a get_value on each field in the form before they are setted

lp bug: https://launchpad.net/bugs/865048 fixed

bzr revid: nicolas.vanhoren@openerp.com-20111017162228-0xazc4zhd9dwj28k
This commit is contained in:
niv-openerp 2011-10-17 18:22:28 +02:00
parent 27b33a7e01
commit fc01a139be
1 changed files with 7 additions and 3 deletions

View File

@ -1888,6 +1888,7 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
init: function(view, node) {
this._super(view, node);
this.is_started = $.Deferred();
this.is_setted = $.Deferred();
this.form_last_update = $.Deferred();
this.init_form_last_update = this.form_last_update;
this.disable_utility_classes = true;
@ -1952,9 +1953,11 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
this.viewmanager.on_mode_switch.add_first(function() {
self.save_form_view();
});
setTimeout(function () {
self.viewmanager.appendTo(self.$element);
}, 0);
this.is_setted.then(function() {
setTimeout(function () {
self.viewmanager.appendTo(self.$element);
}, 0);
});
},
reload_current_view: function() {
var self = this;
@ -2031,6 +2034,7 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
$.when(this.is_started).then(function() {
self.reload_current_view();
});
this.is_setted.resolve();
},
get_value: function() {
var self = this;