related to issue 16464: Handle translations in grid
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 21 Jul 2011 13:06:33 +0200
changeset 13231 33e78b4042b4
parent 13230 203ae2768e33
child 13232 6f6a12817c39
related to issue 16464: Handle translations in grid

Property cannot make use of BaseOBObject beacause Property is compiled before
Entities are genereted and BaseOBObject needs the entities to be generated in
order to be compilble.
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
src/org/openbravo/base/model/Property.java
src/org/openbravo/base/structure/BaseOBObject.java
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Jul 21 12:58:30 2011 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Jul 21 13:06:33 2011 +0200
@@ -28,9 +28,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -884,7 +881,7 @@
       }
       // note to_char is added to handle null values correctly
       if (prop.getReferencedProperty() == null) {
-        if (prop.isTranslatable()) {
+        if (prop.isTranslatable() && OBContext.hasTranslationInstalled()) {
           // HQL for trl properties. Doing it as a select because it cannot be done as left join.
           // Example:
           //
--- a/src/org/openbravo/base/model/Property.java	Thu Jul 21 12:58:30 2011 +0200
+++ b/src/org/openbravo/base/model/Property.java	Thu Jul 21 13:06:33 2011 +0200
@@ -39,7 +39,6 @@
 import org.openbravo.base.util.Check;
 import org.openbravo.base.validation.PropertyValidator;
 import org.openbravo.base.validation.ValidationException;
-import org.openbravo.dal.core.OBContext;
 
 /**
  * Together with {@link Entity Entity}, the Property is the main part of the in-memory model. A
@@ -1146,7 +1145,7 @@
    * 
    */
   public boolean isTranslatable() {
-    return translatable && OBContext.hasTranslationInstalled();
+    return translatable;
   }
 
   /**
--- a/src/org/openbravo/base/structure/BaseOBObject.java	Thu Jul 21 12:58:30 2011 +0200
+++ b/src/org/openbravo/base/structure/BaseOBObject.java	Thu Jul 21 13:06:33 2011 +0200
@@ -34,7 +34,6 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.core.OBInterceptor;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.model.ad.system.Language;
 
 /**
  * Base business object, the root of the inheritance tree for all business objects. The class model
@@ -119,7 +118,7 @@
       return null;
     }
 
-    if (p.isTranslatable()) {
+    if (p.isTranslatable() && OBContext.hasTranslationInstalled()) {
       if (!hasLookedForTrl) {
         hasLookedForTrl = true;
         try {