From 1581c43026a5994d805442fd318a7ca5e12aa88c Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Wed, 18 Feb 2015 12:43:31 +0100 Subject: [PATCH] [FIX] web: revoke last_search when the user made his choice Without this, if the user creates a second line (or more) with another search query and presses tab (or clicks somewhere else) quickly, it will take the previous search result instead of the new one because the new one did not occur yet. With this fix, if the search did not have time to process, the Create a product modal appears, just like it already did for the same behavior on the first line. Fixes 620679. --- addons/web/static/src/js/view_form.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 996034f7ebe..f2802c3f5f9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3475,7 +3475,7 @@ instance.web.form.M2ODialog = instance.web.Dialog.extend({ var text = _.str.sprintf(_t("You are creating a new %s, are you sure it does not exist yet?"), self.name); this.$("p").text( text ); this.$buttons.html(QWeb.render("M2ODialog.buttons")); - this.$("input").val(this.getParent().last_query); + this.$("input").val(this.getParent().$input.val()); this.$buttons.find(".oe_form_m2o_qc_button").click(function(e){ if (self.$("input").val() != ''){ self.getParent()._quick_create(self.$("input").val()); @@ -3657,13 +3657,13 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc self.display_value_backup = {}; self.display_value["" + self.last_search[0][0]] = self.last_search[0][1]; self.reinit_value(self.last_search[0][0]); + self.last_search = [] } else { used = true; self.render_value(); } } else { used = true; - self.reinit_value(false); } self.floating = false; } @@ -3737,7 +3737,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc // disabled to solve a bug, but may cause others //close: anyoneLoosesFocus, minLength: 0, - delay: 250, + delay: 200, }); var appendTo = this.$el.parents('.oe_view_manager_body, .modal-dialog').last(); if (appendTo.length === 0){