Fixes Issue 26817: In Financial Account window, autosave is wrongly triggered while navigating with keyboard
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Mon, 16 Jun 2014 20:24:09 +0530
changeset 23491 6b17763435cf
parent 23490 10cba80c42cc
child 23492 e228a576ef80
Fixes Issue 26817: In Financial Account window, autosave is wrongly triggered while navigating with keyboard

handles a corner case where the event of the previous field is called for the current field,
in this case, the request is prevented. The same fix is also applied to ob-formitem-fk-combo.js
since it will used from Q3.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Mon Jun 16 13:30:06 2014 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Mon Jun 16 20:24:09 2014 +0530
@@ -47,5 +47,18 @@
       this._editorEnterValue = null;
     }
     this.Super('setValue', arguments);
+  },
+  
+  /**
+   * handles a corner case where the event of the previous field is called for the current field,
+   * refer issue https://issues.openbravo.com/view.php?id=26817. In this case, the event is not triggered.
+   */
+  handleKeyPress: function (event, eventInfo) {
+    var key = isc.EH.lastEvent.keyName;
+    if (key === 'Enter' && event.itemInfo && event.itemInfo.item && event.itemInfo.item.name && event.itemInfo.item.name !== this.name) {
+      return true;
+    } else {
+      return this.Super('handleKeyPress', arguments);
+    }
   }
 });
\ No newline at end of file