[FIX] kanban quick-create: don't attempt creation if the field is empty
authorXavier Morel <xmo@openerp.com>
Wed, 28 Nov 2012 14:04:28 +0000 (15:04 +0100)
committerXavier Morel <xmo@openerp.com>
Wed, 28 Nov 2012 14:04:28 +0000 (15:04 +0100)
bzr revid: xmo@openerp.com-20121128140428-s7w860xq7wlbi966

addons/web_kanban/static/src/js/kanban.js

index 398d65d..d84515c 100644 (file)
@@ -1070,8 +1070,10 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({
      */
     quick_add: function () {
         var self = this;
+        var val = this.$input.val();
+        if (/^\s*$/.test(val)) { return; }
         this._dataset.call(
-            'name_create', [self.$input.val() || false, new instance.web.CompoundContext(
+            'name_create', [val, new instance.web.CompoundContext(
                     this._dataset.get_context(), this._context)])
             .then(function(record) {
                 self.$input.val("");