[fix] fixed some problem with quick create showing
authorniv-openerp <nicolas.vanhoren@openerp.com>
Tue, 14 Jun 2011 08:10:46 +0000 (10:10 +0200)
committerniv-openerp <nicolas.vanhoren@openerp.com>
Tue, 14 Jun 2011 08:10:46 +0000 (10:10 +0200)
bzr revid: nicolas.vanhoren@openerp.com-20110614081046-lmjzas5k3d6ye5pb

addons/base/static/src/js/form.js

index a76b812..05a3762 100644 (file)
@@ -1143,7 +1143,10 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
                     });
                 }});
             }
-            if (self.value === undefined) {
+            var raw_result = _(data.result).map(function(x) {return x[1];})
+            if (search_val.length > 0 &&
+                !_.include(raw_result, search_val) &&
+                (!self.value || search_val !== self.value[1])) {
                 values.push({label: '<em>   Create "<strong>' +
                         $('<span />').text(search_val).html() + '</strong>"</em>', action: function() {
                     self._quick_create(search_val);