[FIX] problem with tipsy & quick create in m2o

bzr revid: nicolas.vanhoren@openerp.com-20120810134815-qt91cbf1rndvxn0a
This commit is contained in:
niv-openerp 2012-08-10 15:48:15 +02:00
parent b0abe3a595
commit f3d824424f
1 changed files with 23 additions and 14 deletions

View File

@ -2784,8 +2784,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
} }
} }
}); });
var tip_def = $.Deferred(); self.tip_def = $.Deferred();
var untip_def = $.Deferred(); self.untip_def = $.Deferred();
var tip_delay = 200; var tip_delay = 200;
var tip_duration = 15000; var tip_duration = 15000;
var anyoneLoosesFocus = function() { var anyoneLoosesFocus = function() {
@ -2807,24 +2807,25 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
} }
self.floating = false; self.floating = false;
} }
if (used && self.get("value") === false) { if (used && self.get("value") === false && ! self.no_tipsy) {
tip_def.reject(); self.tip_def.reject();
untip_def.reject(); self.untip_def.reject();
tip_def = $.Deferred(); self.tip_def = $.Deferred();
tip_def.then(function() { self.tip_def.then(function() {
self.$input.tipsy("show"); self.$input.tipsy("show");
}); });
setTimeout(function() { setTimeout(function() {
tip_def.resolve(); self.tip_def.resolve();
untip_def.reject(); self.untip_def.reject();
untip_def = $.Deferred(); self.untip_def = $.Deferred();
untip_def.then(function() { self.untip_def.then(function() {
self.$input.tipsy("hide"); self.$input.tipsy("hide");
}); });
setTimeout(function() {untip_def.resolve();}, tip_duration); setTimeout(function() {self.untip_def.resolve();}, tip_duration);
}, tip_delay); }, tip_delay);
} else { } else {
tip_def.reject(); self.no_tipsy = false;
self.tip_def.reject();
} }
}; };
this.$input.focusout(anyoneLoosesFocus); this.$input.focusout(anyoneLoosesFocus);
@ -2953,7 +2954,15 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
}, },
focus: function () { focus: function () {
this.$input.focus(); this.$input.focus();
} },
_quick_create: function() {
this.no_tipsy = true;
return instance.web.form.CompletionFieldMixin._quick_create.apply(this, arguments);
},
_search_create_popup: function() {
this.no_tipsy = true;
return instance.web.form.CompletionFieldMixin._search_create_popup.apply(this, arguments);
},
}); });
/* /*