Fixes issue 20297: [SC Upgrade] name and searchkey empty in product selector popup
authorMartin Taal <martin.taal@openbravo.com>
Mon, 23 Apr 2012 00:45:50 +0200
changeset 16327 e163ad46f5d7
parent 16326 1f0219608908
child 16328 ddf5d77eae4a
Fixes issue 20297: [SC Upgrade] name and searchkey empty in product selector popup
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceJavaScriptCreator.java
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
src/org/openbravo/dal/core/DalUtil.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Mon Apr 23 00:45:50 2012 +0200
@@ -95,7 +95,7 @@
             },          
         </#if>
         <#if field.searchField>
-            displayField: '${field.name?js_string}._identifier',
+            displayField: '${field.name?js_string}$_identifier',
             <#if field.parentProperty>
                 showPickerIcon: ${(!field.parentProperty)?string},
             </#if>
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Mon Apr 23 00:45:50 2012 +0200
@@ -33,7 +33,7 @@
     }
 
     var display = this.mapValueToDisplay(value),
-        identifierFieldName = this.name + '.' + OB.Constants.IDENTIFIER;
+        identifierFieldName = this.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
     form.setValue(identifierFieldName, display);
     // make sure that the grid does not display the old identifier
     if (form.grid) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Mon Apr 23 00:45:50 2012 +0200
@@ -261,7 +261,7 @@
       var parentRecord = this.view.getParentRecord();
       if (parentRecord) {
         this.setValue(this.view.parentProperty, parentRecord.id);
-        this.setValue(this.view.parentProperty + '.' + OB.Constants.IDENTIFIER, parentRecord[OB.Constants.IDENTIFIER]);
+        this.setValue(this.view.parentProperty + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, parentRecord[OB.Constants.IDENTIFIER]);
         if (this.getField(this.view.parentProperty) && !this.getField(this.view.parentProperty).valueMap) {
           var valueMap = {};
           this.getField(this.view.parentProperty).valueMap = valueMap;
@@ -986,10 +986,10 @@
             // only set the display field name if the field does not have its own
             // datasource and the field displayfield contains a dot, otherwise 
             // it is a direct field
-            if (field.displayField && field.displayField.contains('.') && !this.getField(field.displayField) && !field.optionDataSource && !field.getDataSource()) {
+            if (field.displayField && field.displayField.contains(OB.Constants.SEPARATOR) && !this.getField(field.displayField) && !field.optionDataSource && !field.getDataSource()) {
               field.form.setItemValue(field.displayField, identifier);
             } else if (!field.displayField) {
-              field.form.setItemValue(field.name + '.' + OB.Constants.IDENTIFIER, identifier);
+              field.form.setItemValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, identifier);
             }
           }
         }
@@ -1000,8 +1000,8 @@
       // note: do not use clearvalue as this removes the value from the form
       // which results it to not be sent to the server anymore
       this.setValue(field.name, null);
-      if (this.getValue(field.name + '.' + OB.Constants.IDENTIFIER)) {
-        this.setItemValue(field.name + '.' + OB.Constants.IDENTIFIER, null);
+      if (this.getValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
+        this.setItemValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, null);
       }
     }
 
@@ -1064,7 +1064,7 @@
           identifier = valueMap[columnValue.value];
         }
         if (identifier) {
-          editValues[prop + '.' + OB.Constants.IDENTIFIER] = identifier;
+          editValues[prop + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER] = identifier;
         }
         editValues[prop] = columnValue.value;
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Mon Apr 23 00:45:50 2012 +0200
@@ -287,8 +287,8 @@
             continue;
           }
           fullPropName = prop;
-          if (prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
-            var index = prop.lastIndexOf('.');
+          if (prop.endsWith(OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
+            var index = prop.lastIndexOf(OB.Constants.SEPARATOR);
             prop = prop.substring(0, index);
           }
           var fnd = false,
@@ -505,8 +505,8 @@
       }
       var value = criterion.value;
       // see the description in setValuesAsCriteria above
-      if (prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
-        var index = prop.lastIndexOf('.');
+      if (prop.endsWith(OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
+        var index = prop.lastIndexOf(OB.Constants.SEPARATOR);
         prop = prop.substring(0, index);
       }
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Mon Apr 23 00:45:50 2012 +0200
@@ -1410,7 +1410,7 @@
         title: OB.I18N.getLabel('OBUIAPP_OpenOnTab'),
         click: function () {
           var fldName = field.name;
-          var dotIndex = fldName.indexOf('.');
+          var dotIndex = fldName.indexOf(OB.Constants.SEPARATOR);
           if (dotIndex !== -1) {
             fldName = fldName.substring(0, dotIndex);
           }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js	Mon Apr 23 00:45:50 2012 +0200
@@ -83,7 +83,7 @@
       var correctedData = {},
           prop;
       for (prop in data) {
-        if (data.hasOwnProperty(prop) && !prop.contains('.')) {
+        if (data.hasOwnProperty(prop) && !prop.contains(OB.Constants.SEPARATOR)) {
           correctedData[prop] = data[prop];
         }
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Mon Apr 23 00:45:50 2012 +0200
@@ -2126,7 +2126,7 @@
       }
 
       if (fld.fkField) {
-        fld.displayField = fld.name + '.' + OB.Constants.IDENTIFIER;
+        fld.displayField = fld.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
         fld.valueField = fld.name;
       }
 
@@ -2148,8 +2148,8 @@
       fld.filterEditorProperties.required = false;
 
       if (fld.fkField) {
-        fld.filterEditorProperties.displayField = fld.name + '.' + OB.Constants.IDENTIFIER;
-        fld.filterEditorProperties.valueField = fld.name + '.' + OB.Constants.IDENTIFIER;
+        fld.filterEditorProperties.displayField = fld.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
+        fld.filterEditorProperties.valueField = fld.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
       }
 
       result.push(fld);
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Mon Apr 23 00:45:50 2012 +0200
@@ -58,6 +58,7 @@
     Constants : {
         IDENTIFIER : '_identifier',
         ID : 'id',
+        SEPARATOR : '$',
         WHERE_PARAMETER : '_where',
         ORG_PARAMETER : '_org',
         ORDERBY_PARAMETER : '_orderBy',
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceJavaScriptCreator.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceJavaScriptCreator.java	Mon Apr 23 00:45:50 2012 +0200
@@ -27,6 +27,7 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.Property;
+import org.openbravo.dal.core.DalUtil;
 import org.openbravo.service.datasource.DataSourceProperty.RefListEntry;
 import org.openbravo.service.json.JsonConstants;
 import org.openbravo.service.web.BaseWebServiceServlet;
@@ -154,7 +155,7 @@
 
   protected String getReferenceProperty(Property property, String subPropName) {
     final StringBuilder sb = new StringBuilder("{");
-    sb.append("name: \"" + property.getName() + "." + subPropName + "\"");
+    sb.append("name: \"" + property.getName() + DalUtil.FIELDSEPARATOR + subPropName + "\"");
     sb.append(", type: \"text\"");
     sb.append(", hidden: true");
     if (property.isMandatory()) {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Mon Apr 23 00:45:50 2012 +0200
@@ -401,8 +401,8 @@
           }
           sb.append(prop.getName());
         }
-        throw new OBException(OBMessageUtils.getI18NMessage("OBJSON_InvalidProperty",
-            new String[] { value.toString(), sb.toString() }));
+        throw new OBException(OBMessageUtils.getI18NMessage("OBJSON_InvalidProperty", new String[] {
+            value.toString(), sb.toString() }));
       }
       final Property fieldProperty = properties.get(properties.size() - 1);
       if (property == null) {
@@ -424,7 +424,7 @@
     // handle a special case the table reference which shows a tablename in a combo
     // or uses the display column to display that in the grid
     Property useProperty = property;
-    String useFieldName = fieldName;
+    String useFieldName = fieldName.replace(DalUtil.FIELDSEPARATOR, DalUtil.DOT);
     if (properties.size() >= 2) {
       final Property refProperty = properties.get(properties.size() - 2);
       if (refProperty.getDomainType() instanceof TableDomainType) {
@@ -433,8 +433,8 @@
             Table.ENTITY_NAME);
         if (isTable) {
           useProperty = property.getEntity().getProperty(Table.PROPERTY_NAME);
-          final int index = fieldName.indexOf(".");
-          useFieldName = fieldName.substring(0, index + 1) + useProperty.getName();
+          final int index = useFieldName.indexOf(DalUtil.DOT);
+          useFieldName = useFieldName.substring(0, index + 1) + useProperty.getName();
         } else {
           // read the reference to get the table reference
           final Reference reference = OBDal.getInstance().get(Reference.class,
@@ -444,8 +444,8 @@
                 && referencedTable.getDisplayedColumn().isActive()) {
               useProperty = property.getEntity().getPropertyByColumnName(
                   referencedTable.getDisplayedColumn().getDBColumnName());
-              final int index = fieldName.indexOf(".");
-              useFieldName = fieldName.substring(0, index + 1) + useProperty.getName();
+              final int index = useFieldName.indexOf(DalUtil.DOT);
+              useFieldName = useFieldName.substring(0, index + 1) + useProperty.getName();
               break;
             }
           }
@@ -457,7 +457,7 @@
     if (orNesting > 0) {
       clause = resolveJoins(properties, useFieldName);
     } else if (getMainAlias() != null) {
-      clause = getMainAlias() + "." + useFieldName.trim();
+      clause = getMainAlias() + DalUtil.DOT + useFieldName.trim();
     } else {
       clause = useFieldName;
     }
@@ -468,10 +468,11 @@
     // because the key contains the original string (with the _identifier part).
     // Within the if the leftWherePart is used because it contains the join aliases
     if (useFieldName.equals(JsonConstants.IDENTIFIER)
-        || useFieldName.endsWith("." + JsonConstants.IDENTIFIER)) {
-      if (useFieldName.endsWith("." + JsonConstants.IDENTIFIER)
+        || useFieldName.endsWith(DalUtil.DOT + JsonConstants.IDENTIFIER)) {
+      if (useFieldName.endsWith(DalUtil.DOT + JsonConstants.IDENTIFIER)
           && (operator.equals(OPERATOR_ISNULL) || operator.equals(OPERATOR_NOTNULL))) {
-        clause = getMainAlias() + "." + useFieldName.replace("." + JsonConstants.IDENTIFIER, "");
+        clause = getMainAlias() + DalUtil.DOT
+            + useFieldName.replace(DalUtil.DOT + JsonConstants.IDENTIFIER, "");
       } else {
         clause = computeLeftWhereClauseForIdentifier(useProperty, useFieldName, clause);
       }
@@ -643,9 +644,9 @@
     Check.isTrue(identifierProperties.contains(property), "Property " + property
         + " not part of identifier of " + property.getEntity());
     final String prefix;
-    final int index = leftWherePart.lastIndexOf(".");
+    final int index = leftWherePart.lastIndexOf(DalUtil.DOT);
     if (key.equals(JsonConstants.IDENTIFIER)) {
-      prefix = getMainAlias() + ".";
+      prefix = getMainAlias() + DalUtil.DOT;
     } else if (index == -1) {
       prefix = "";
     } else {
@@ -951,7 +952,8 @@
       if (!firstElement) {
         sb.append(",");
       }
-      sb.append(getOrderByClausePart(localOrderBy.trim()));
+      sb.append(getOrderByClausePart(localOrderBy.trim().replace(DalUtil.FIELDSEPARATOR,
+          DalUtil.DOT)));
       firstElement = false;
     }
 
@@ -978,7 +980,7 @@
     // handle the following case:
     // table.window.identifier as the sort string
     boolean isIdentifier = localOrderBy.equals(JsonConstants.IDENTIFIER)
-        || localOrderBy.endsWith("." + JsonConstants.IDENTIFIER);
+        || localOrderBy.endsWith(DalUtil.DOT + JsonConstants.IDENTIFIER);
     if (isIdentifier) {
       Entity searchEntity = getEntity();
       // a path to an entity, find the last entity
@@ -989,7 +991,7 @@
         Check.isNotNull(prop, "Property path " + localOrderBy + " is not valid for entity "
             + searchEntity);
         searchEntity = prop.getEntity();
-        prefix = localOrderBy.substring(0, localOrderBy.lastIndexOf(".") + 1);
+        prefix = localOrderBy.substring(0, localOrderBy.lastIndexOf(DalUtil.DOT) + 1);
       } else {
         prefix = "";
       }
@@ -1005,7 +1007,7 @@
           // wrong identifier definitions in the AD
           final Entity targetEntity = prop.getTargetEntity();
           for (Property targetEntityProperty : targetEntity.getIdentifierProperties()) {
-            paths.add(prefix + prop.getName() + "." + targetEntityProperty.getName());
+            paths.add(prefix + prop.getName() + DalUtil.DOT + targetEntityProperty.getName());
           }
         } else {
           paths.add(prefix + prop.getName());
@@ -1071,7 +1073,8 @@
       } else {
         final List<Property> newIdentifierProperties = prop.getReferencedProperty().getEntity()
             .getIdentifierProperties();
-        sb.append(createIdentifierLeftClause(newIdentifierProperties, prefix + prop.getName() + "."));
+        sb.append(createIdentifierLeftClause(newIdentifierProperties, prefix + prop.getName()
+            + DalUtil.DOT));
       }
     }
 
@@ -1166,7 +1169,7 @@
     if (joinedPropertyIndex == (props.size() - 1)) {
       return alias;
     }
-    return alias + "." + props.get(props.size() - 1).getName();
+    return alias + DalUtil.DOT + props.get(props.size() - 1).getName();
   }
 
   private String getNewUniqueAlias() {
@@ -1184,9 +1187,10 @@
 
     public String getJoinStatement() {
       if (orNesting > 0) {
-        return " left outer join " + ownerAlias + "." + property.getName() + " as " + joinAlias;
+        return " left outer join " + ownerAlias + DalUtil.DOT + property.getName() + " as "
+            + joinAlias;
       } else {
-        return " left join " + ownerAlias + "." + property.getName() + " as " + joinAlias;
+        return " left join " + ownerAlias + DalUtil.DOT + property.getName() + " as " + joinAlias;
       }
     }
 
@@ -1222,7 +1226,8 @@
   public void setOrderBy(String orderBy) {
     this.orderBy = orderBy;
     // do outer joining if the order by has more than 1 dot
-    if (orderBy.indexOf(".") != -1 && orderBy.indexOf(".") != orderBy.lastIndexOf(".")) {
+    if (orderBy.indexOf(DalUtil.DOT) != -1
+        && orderBy.indexOf(DalUtil.DOT) != orderBy.lastIndexOf(DalUtil.DOT)) {
       setMainAlias(JsonConstants.MAIN_ALIAS);
     }
   }
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Mon Apr 23 00:45:50 2012 +0200
@@ -174,9 +174,9 @@
               .getPropertyFromPath(bob.getEntity(), additionalProperty);
           // identifier
           if (additionalProperty.endsWith(JsonConstants.IDENTIFIER)) {
-            jsonObject.put(additionalProperty, value);
+            jsonObject.put(replaceDots(additionalProperty), value);
           } else {
-            jsonObject.put(additionalProperty, convertPrimitiveValue(property, value));
+            jsonObject.put(replaceDots(additionalProperty), convertPrimitiveValue(property, value));
           }
         }
       }
@@ -191,6 +191,10 @@
     }
   }
 
+  private String replaceDots(String value) {
+    return value.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
+  }
+
   private Property getPropertyFromPath(BaseOBObject bob, String propertyPath) {
     final String[] parts = propertyPath.split("\\.");
     BaseOBObject currentBob = bob;
@@ -227,13 +231,14 @@
       } catch (ObjectNotFoundException e) {
         // Referenced object does not exist, set UUID
         jsonObject.put(propertyName, e.getIdentifier());
-        jsonObject.put(propertyName + "." + JsonConstants.IDENTIFIER, e.getIdentifier());
+        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
+            e.getIdentifier());
         return;
       }
     } else {
       jsonObject.put(propertyName, obObject.getId());
     }
-    // jsonObject.put(propertyName + "." + JsonConstants.ID, obObject.getId());
+    // jsonObject.put(propertyName + DalUtil.DOT + JsonConstants.ID, obObject.getId());
 
     if (referencingProperty != null && referencingProperty.hasDisplayColumn()) {
 
@@ -241,19 +246,21 @@
           referencingProperty.getDisplayPropertyName());
       if (displayColumnProperty.hasDisplayColumn()) {
         // Allowing one level deep of displayed column pointing to references with display column
-        jsonObject.put(propertyName + "." + JsonConstants.IDENTIFIER, ((BaseOBObject) obObject
-            .get(referencingProperty.getDisplayPropertyName())).get(displayColumnProperty
-            .getDisplayPropertyName()));
+        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
+            ((BaseOBObject) obObject.get(referencingProperty.getDisplayPropertyName()))
+                .get(displayColumnProperty.getDisplayPropertyName()));
       } else if (!displayColumnProperty.isPrimitive()) {
         // Displaying identifier for non primitive properties
-        jsonObject.put(propertyName + "." + JsonConstants.IDENTIFIER, ((BaseOBObject) obObject
-            .get(referencingProperty.getDisplayPropertyName())).getIdentifier());
+        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
+            ((BaseOBObject) obObject.get(referencingProperty.getDisplayPropertyName()))
+                .getIdentifier());
       } else {
-        jsonObject.put(propertyName + "." + JsonConstants.IDENTIFIER,
+        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
             obObject.get(referencingProperty.getDisplayPropertyName()));
       }
     } else {
-      jsonObject.put(propertyName + "." + JsonConstants.IDENTIFIER, obObject.getIdentifier());
+      jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
+          obObject.getIdentifier());
     }
   }
 
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java	Mon Apr 23 00:45:50 2012 +0200
@@ -35,6 +35,7 @@
 import org.openbravo.base.model.Property;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.OBError;
@@ -243,7 +244,7 @@
    * @return the list of properties determined from the property path
    */
   public static List<Property> getPropertiesOnPath(Entity entity, String propertyPath) {
-    final String[] parts = propertyPath.split("\\.");
+    final String[] parts = propertyPath.replace(DalUtil.FIELDSEPARATOR, ".").split("\\.");
     Entity currentEntity = entity;
     Property result = null;
     final List<Property> properties = new ArrayList<Property>();
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Mon Apr 23 00:45:50 2012 +0200
@@ -164,7 +164,7 @@
       String fieldName = getPropertyOrDataSourceField(selectorField);
       final DomainType domainType = getDomainType(selectorField);
       if (domainType instanceof ForeignKeyDomainType) {
-        fieldName = fieldName + "." + JsonConstants.IDENTIFIER;
+        fieldName = fieldName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER;
       }
       if (extraProperties.length() > 0) {
         extraProperties.append(",");
@@ -201,15 +201,18 @@
     if (getSelector().isCustomQuery()) {
       if (getSelector().getDisplayfield() != null
           && getSelector().getDisplayfield().getDisplayColumnAlias() != null) {
-        return getSelector().getDisplayfield().getDisplayColumnAlias();
+        return getSelector().getDisplayfield().getDisplayColumnAlias()
+            .replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
       }
       return JsonConstants.IDENTIFIER;
     }
     if (getSelector().getDisplayfield() != null && getSelector().getDisplayfield().isShowingrid()) {
       if (getSelector().getDisplayfield().getProperty() != null) {
-        return getSelector().getDisplayfield().getProperty();
+        return getSelector().getDisplayfield().getProperty()
+            .replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
       } else {
-        return getSelector().getDisplayfield().getObserdsDatasourceField().getName();
+        return getSelector().getDisplayfield().getObserdsDatasourceField().getName()
+            .replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
       }
     }
     // a very common case, return the first selector field which is part of the
@@ -282,10 +285,11 @@
   public String getValueField() {
     if (getSelector().getValuefield() != null) {
       String valueField = getPropertyOrDataSourceField(getSelector().getValuefield());
+      valueField = valueField.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
       if (!getSelector().isCustomQuery()) {
         final DomainType domainType = getDomainType(getSelector().getValuefield());
         if (domainType instanceof ForeignKeyDomainType) {
-          return valueField + "." + JsonConstants.ID;
+          return valueField + DalUtil.FIELDSEPARATOR + JsonConstants.ID;
         }
       }
       return valueField;
@@ -444,7 +448,7 @@
         // in that case always show the identifier
         final DomainType domainType = getDomainType(selectorField);
         if (domainType instanceof ForeignKeyDomainType) {
-          fieldName = fieldName + "." + JsonConstants.IDENTIFIER;
+          fieldName = fieldName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER;
         }
 
         if (sb.length() > 0) {
@@ -634,10 +638,13 @@
       // in that case always show the identifier
       final DomainType domainType = getDomainType(selectorField);
       if (domainType instanceof ForeignKeyDomainType) {
-        String displayField = fieldName + "." + JsonConstants.IDENTIFIER;
+        String displayField = fieldName.replace(".", DalUtil.FIELDSEPARATOR)
+            + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER;
         localSelectorField.setDisplayField(displayField);
       }
 
+      fieldName = fieldName.replace(".", DalUtil.FIELDSEPARATOR);
+
       localSelectorField.setName(fieldName);
       localSelectorField.setTitle(getTranslatedName(selectorField));
       localSelectorField.setSort(!pickList && selectorField.isSortable());
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java	Mon Apr 23 00:45:50 2012 +0200
@@ -32,6 +32,7 @@
 import org.openbravo.client.application.OBBindings;
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.client.kernel.KernelConstants;
+import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
@@ -81,10 +82,11 @@
           exprResult = engine.eval(f.getDefaultExpression());
 
           if (sel.isCustomQuery()) {
-            result.put(f.getDisplayColumnAlias(), exprResult);
+            result.put(f.getDisplayColumnAlias().replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR),
+                exprResult);
           } else {
             String fieldName = f.getProperty();
-            result.put(fieldName, exprResult);
+            result.put(fieldName.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR), exprResult);
           }
         } catch (Exception e) {
           log.error(
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Mon Apr 23 00:45:50 2012 +0200
@@ -108,7 +108,9 @@
       // fallback to the default
       return null;
     }
-    return prop.getName() + "." + displayFieldName;
+    final String result = (prop.getName() + DalUtil.FIELDSEPARATOR + displayFieldName).replace(".",
+        DalUtil.FIELDSEPARATOR);
+    return result;
   }
 
   public String getFieldProperties(Field field) {
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl	Mon Apr 23 00:45:50 2012 +0200
@@ -20,7 +20,7 @@
     popupTextMatchStyle: '${data.selector.popuptextmatchstyle}',
     suggestionTextMatchStyle: '${data.selector.suggestiontextmatchstyle}',
     defaultPopupFilterField : '${data.defaultPopupFilterField}',
-    displayField: '${data.targetPropertyName?js_string}._identifier',
+    displayField: '${data.targetPropertyName?js_string}$_identifier',
     valueField: '${data.targetPropertyName?js_string}',
     gridDisplayField: '${data.displayField?js_string}',
     gridValueField: '${data.valueField?js_string}',    
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Thu Apr 19 12:47:58 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Mon Apr 23 00:45:50 2012 +0200
@@ -460,23 +460,23 @@
 
   setValueFromRecord: function (record, fromPopup) {
     var currentValue = this.getValue(),
-        identifierFieldName = this.name + '.' + OB.Constants.IDENTIFIER,
+        identifierFieldName = this.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER,
         i;
     if (!record) {
       this.storeValue(null);
-      this.form.setValue(this.name + '.' + this.displayField, null);
+      this.form.setValue(this.name + OB.Constants.SEPARATOR + this.displayField, null);
       this.form.setValue(identifierFieldName, null);
 
       // make sure that the grid does not display the old identifier
       if (this.form.grid && this.form.grid.getEditForm()) {
         this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name, null);
         this.form.grid.setEditValue(this.form.grid.getEditRow(), identifierFieldName, '');
-        this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name + '.' + this.displayField, '');
+        this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name + OB.Constants.SEPARATOR + this.displayField, '');
       }
     } else {
       this.handleOutFields(record);
       this.storeValue(record[this.valueField]);
-      this.form.setValue(this.name + '.' + this.displayField, record[this.displayField]);
+      this.form.setValue(this.name + OB.Constants.SEPARATOR + this.displayField, record[this.displayField]);
       this.form.setValue(identifierFieldName, record[OB.Constants.IDENTIFIER]);
       if (!this.valueMap) {
         this.valueMap = {};
--- a/src/org/openbravo/dal/core/DalUtil.java	Thu Apr 19 12:47:58 2012 +0200
+++ b/src/org/openbravo/dal/core/DalUtil.java	Mon Apr 23 00:45:50 2012 +0200
@@ -49,6 +49,9 @@
 
   private static final String IDENTIFIER_PART_PATH = "_identifier";
 
+  public static final String FIELDSEPARATOR = "$";
+  public static final String DOT = ".";
+
   /**
    * Sorts the passed list according to the identifier of the objects.
    * 
@@ -79,7 +82,7 @@
    * @return the found property
    */
   public static Property getPropertyFromPath(Entity entity, String propertyPath) {
-    final String[] parts = propertyPath.split("\\.");
+    final String[] parts = propertyPath.replace(FIELDSEPARATOR, DOT).split("\\" + DOT);
     Entity currentEntity = entity;
     Property result = null;
     for (String part : parts) {
@@ -137,7 +140,7 @@
    * @return the found property
    */
   public static Object getValueFromPath(BaseOBObject bob, String propertyPath) {
-    final String[] parts = propertyPath.split("\\.");
+    final String[] parts = propertyPath.replace(FIELDSEPARATOR, DOT).split("\\" + DOT);
     BaseOBObject currentBob = bob;
     Property result = null;
     Object value = null;