Fixes Issue 26817: In Financial Account window, autosave is wrongly triggered while navigating with keyboard
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Wed, 11 Jun 2014 23:38:19 +0530
changeset 23473 b4ba48792e48
parent 23472 2b8030095ea6
child 23474 153d5f9b6e1b
child 23476 f7e99944d00b
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
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-formitem-fk-combo.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-formitem-fk-combo.js	Wed Jun 11 12:08:24 2014 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-formitem-fk-combo.js	Wed Jun 11 23:38:19 2014 +0530
@@ -183,5 +183,18 @@
       }
     }
     this.Super('destroy', 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 {
+      this.Super('handleKeyPress', arguments);
+    }
   }
 });
\ No newline at end of file