[FIX] web: form: quick create: name is now required to avoid creating records with a void name

This commit is contained in:
ptr 2014-09-19 10:48:01 +05:30 committed by Thibault Delavallée
parent fb4db6c938
commit 130873f0f6
1 changed files with 8 additions and 3 deletions

View File

@ -3458,9 +3458,14 @@ instance.web.form.M2ODialog = instance.web.Dialog.extend({
this.$("p").text( text );
this.$buttons.html(QWeb.render("M2ODialog.buttons"));
this.$("input").val(this.getParent().last_query);
this.$buttons.find(".oe_form_m2o_qc_button").click(function(){
self.getParent()._quick_create(self.$("input").val());
self.destroy();
this.$buttons.find(".oe_form_m2o_qc_button").click(function(e){
if (self.$("input").val() != ''){
self.getParent()._quick_create(self.$("input").val());
self.destroy();
} else{
e.preventDefault();
self.$("input").focus();
}
});
this.$buttons.find(".oe_form_m2o_sc_button").click(function(){
self.getParent()._search_create_popup("form", undefined, self.getParent()._create_context(self.$("input").val()));