Related to issue 22801: Refactors fix to prevent regression
authorAugusto Mauch <augusto.mauch@openbravo.com>
Tue, 15 Jan 2013 18:29:01 +0100
changeset 19226 fd1963891b04
parent 19225 1b6f10404788
child 19227 f6d77303909a
Related to issue 22801: Refactors fix to prevent regression

The fix has been refactored, because the previous approach was causing a regression. Now, the mapValueToDisplay will only be used if the newValue is an UUID, and that function will not be used in the filterDataBoundPickList function (it was not needed).
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Jan 15 16:39:56 2013 +0100
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Jan 15 18:29:01 2013 +0100
@@ -402,13 +402,19 @@
   // changed handles the case that the user removes the value using the keyboard
   // this should do the same things as setting the value through the pickvalue
   changed: function (form, item, newValue) {
+    var identifier;
     // only do the identifier actions when clearing
     // in all other cases pickValue is called
     if (!newValue) {
       this.setValueFromRecord(null);
     }
+    if (OB.Utilities.isUUID(newValue)) {
+      identifier = this.mapValueToDisplay(newValue);
+    } else {
+      identifier = newValue;
+    }
     //Setting the element value again to align the cursor position correctly.
-    this.setElementValue(this.mapValueToDisplay(newValue));
+    this.setElementValue(identifier);
   },
 
   setPickListWidth: function () {
@@ -628,10 +634,10 @@
     }
 
     if (this.form.getFocusItem() !== this && !this.form.view.isShowingForm && this.getEnteredValue() === '' && this.savedEnteredValue) {
-      this.setElementValue(this.mapValueToDisplay(this.savedEnteredValue));
+      this.setElementValue(this.savedEnteredValue);
       delete this.savedEnteredValue;
     } else if (this.form.view.isShowingForm && this.getEnteredValue() === '' && this.savedEnteredValue) {
-      this.setElementValue(this.mapValueToDisplay(this.savedEnteredValue));
+      this.setElementValue(this.savedEnteredValue);
       delete this.savedEnteredValue;
     }