fixed bug 15551: Linked items are not working
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 31 Dec 2010 12:53:14 +0100
changeset 9509 19e6880578da
parent 9507 b60bcce81c3a
child 9510 db0ac9854e2d
fixed bug 15551: Linked items are not working

After ad_model_object cleanup (#14236) tab url cannot be calculated based on
it. Using instead Utility.getTabURL method.
modules/org.openbravo.client.application/src/org/openbravo/client/application/ComputeWindowActionHandler.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ComputeWindowActionHandler.java	Fri Dec 31 10:06:45 2010 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ComputeWindowActionHandler.java	Fri Dec 31 12:53:14 2010 +0100
@@ -34,8 +34,7 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
 import org.openbravo.data.Sqlc;
-import org.openbravo.model.ad.domain.ModelImplementation;
-import org.openbravo.model.ad.domain.ModelImplementationMapping;
+import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.system.Language;
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.ad.ui.WindowTrl;
@@ -90,22 +89,10 @@
           + Sqlc.TransformaNombreColumna(entity.getIdProperties().get(0).getColumnName()));
       json.put("tabTitle", tabTitle);
 
-      // find the model object mapping
-      String mappingName = null;
-      for (ModelImplementation modelImpl : tab.getADModelImplementationList()) {
-        for (ModelImplementationMapping mapping : modelImpl.getADModelImplementationMappingList()) {
-          if (mapping.getMappingName() != null
-              && mapping.getMappingName().toLowerCase().contains("edition")) {
-            // found it
-            mappingName = mapping.getMappingName();
-            break;
-          }
-        }
-        if (mappingName != null) {
-          break;
-        }
-      }
-      if (mappingName != null) {
+      // find the model tab url
+      String mappingName = Utility.getTabURL(tabId, "E", false);
+
+      if (mappingName != null && !mappingName.isEmpty()) {
         json.put("mappingName", mappingName);
       }
       return json;