Fixes issue
22801: ID of product not shown if the full product name is entered
The problem was that in the changed function the setElementValue was being called passing newValue as an argument. If the product name is not entered completely, then newValue will be the incomplete name and nothing wrong will happen. The problem is that if the full name is entered, newValue is the product ID, and when it is passed as an argument to setElementValue it is shown as is.
This has been fixed by passing the newValue to the mapValueToDisplay function. If newValue is a partial name the function will return the partial name, and if newValue is the product ID, it will return the product full name.
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Wed Jan 16 01:45:59 2013 +0000
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Tue Jan 15 16:39:56 2013 +0100
@@ -408,7 +408,7 @@
this.setValueFromRecord(null);
}
//Setting the element value again to align the cursor position correctly.
- this.setElementValue(newValue);
+ this.setElementValue(this.mapValueToDisplay(newValue));
},
setPickListWidth: function () {
@@ -628,10 +628,10 @@
}
if (this.form.getFocusItem() !== this && !this.form.view.isShowingForm && this.getEnteredValue() === '' && this.savedEnteredValue) {
- this.setElementValue(this.savedEnteredValue);
+ this.setElementValue(this.mapValueToDisplay(this.savedEnteredValue));
delete this.savedEnteredValue;
} else if (this.form.view.isShowingForm && this.getEnteredValue() === '' && this.savedEnteredValue) {
- this.setElementValue(this.savedEnteredValue);
+ this.setElementValue(this.mapValueToDisplay(this.savedEnteredValue));
delete this.savedEnteredValue;
}