src/org/openbravo/base/structure/IdentifierProvider.java
changeset 20251 13bebe76e732
parent 19861 f9728bac00aa
child 24155 28068c12e140
equal deleted inserted replaced
20250:a7c5a974e6fa 20251:13bebe76e732
     9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
     9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    10  * License for the specific  language  governing  rights  and  limitations
    10  * License for the specific  language  governing  rights  and  limitations
    11  * under the License. 
    11  * under the License. 
    12  * The Original Code is Openbravo ERP. 
    12  * The Original Code is Openbravo ERP. 
    13  * The Initial Developer of the Original Code is Openbravo SLU 
    13  * The Initial Developer of the Original Code is Openbravo SLU 
    14  * All portions are Copyright (C) 2008-2010 Openbravo SLU 
    14  * All portions are Copyright (C) 2008-2013 Openbravo SLU 
    15  * All Rights Reserved. 
    15  * All Rights Reserved. 
    16  * Contributor(s):  ______________________________________.
    16  * Contributor(s):  ______________________________________.
    17  ************************************************************************
    17  ************************************************************************
    18  */
    18  */
    19 
    19 
   116         }
   116         }
   117 
   117 
   118         // Assign displayColumnProperty to apply formatting if needed
   118         // Assign displayColumnProperty to apply formatting if needed
   119         property = displayColumnProperty;
   119         property = displayColumnProperty;
   120       } else if (property.isTranslatable()) {
   120       } else if (property.isTranslatable()) {
   121         value = ((BaseOBObject) dob).get(identifier.getName(), language, (String) dob.get("id"));
   121         // Trying to get id of translatable object.
       
   122         Object id = dob.get("id");
       
   123         if (id instanceof BaseOBObject) {
       
   124           // When the object is created for a drop down list filter, it is incorrect: id is not a
       
   125           // String but a BaseOBject. This code deals with this exception.
       
   126 
       
   127           // TODO: once issue #23706 is fixed, this should not be needed anymore
       
   128           id = ((BaseOBObject) id).get("id");
       
   129         }
       
   130 
       
   131         if (id instanceof String) {
       
   132           value = ((BaseOBObject) dob).get(identifier.getName(), language, (String) id);
       
   133         } else {
       
   134           // give up, couldn't find the id
       
   135           value = ((BaseOBObject) dob).get(identifier.getName(), language);
       
   136         }
       
   137 
   122       } else if (!property.isPrimitive() && identifyDeep) {
   138       } else if (!property.isPrimitive() && identifyDeep) {
   123         if (dob.get(property.getName()) != null) {
   139         if (dob.get(property.getName()) != null) {
   124           value = ((BaseOBObject) dob.get(property.getName())).getIdentifier();
   140           value = ((BaseOBObject) dob.get(property.getName())).getIdentifier();
   125         } else {
   141         } else {
   126           value = "";
   142           value = "";