fixes issue 32478: [object Object] appears after clearing value in selector
authorCarlos Aristu <carlos.aristu@openbravo.com>
Tue, 15 Mar 2016 19:22:47 +0100
changeset 28969 d6a7ec729aa8
parent 28968 35973fc6d1e8
child 28970 21c8ed48293c
fixes issue 32478: [object Object] appears after clearing value in selector

Having singleDateMode as false after clearing the filter content of the date causes the return of an empty object in the getValuesAsCriteria method of the grid. The this.singleDateMode was being set to true in clearFilterValues function, but this statement was deleted to solve issue 31705, because it was preventing to show the range dialog after clearing the filters, when pressing the Enter key.

To solve both problems the change regarding setting singleDateMode in clearFilterValues has been reverted, and in order to ensure that the range dialog is displayed when it should be, a new check has been included in the keyPress method.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Thu Mar 10 17:56:11 2016 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Tue Mar 15 19:22:47 2016 +0100
@@ -457,6 +457,7 @@
   clearFilterValues: function () {
     this.singleDateValue = null;
     this.singleDateDisplayValue = '';
+    this.singleDateMode = true;
     this.rangeItemValue = null;
     this.rangeItem.setValue(null);
     this.setElementValue('', '');
@@ -723,11 +724,15 @@
   },
 
   keyPress: function (item, form, keyName, characterValue) {
+    var enterOnEmptyItem;
     if (keyName === 'Enter') {
       if (this.singleDateMode) {
+        enterOnEmptyItem = !item.getValue() && !item.getEnteredValue();
         this.expandSingleValue();
         this.form.grid.performAction();
-        return false;
+        if (!enterOnEmptyItem) {
+          return false;
+        }
       }
       this.showRangeDialog();
       return false;