From ebb3dec44e63da548ffc1060e5c62c1972032c1f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 28 Sep 2011 09:37:36 -0500 Subject: [PATCH] IDEMPIERE-78 Error using tables terminated in TO --- .../src/org/compiere/model/GridFieldVO.java | 5 ++++- .../src/org/compiere/model/MQuery.java | 17 ++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index 6c4fc94f05..446291c4a3 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -510,7 +510,10 @@ public class GridFieldVO implements Serializable lookupInfo = MLookupFactory.getLookupInfo (ctx, WindowNo, AD_Column_ID, displayType, Env.getLanguage(ctx), ColumnName, AD_Reference_Value_ID, IsParent, ValidationCode); - lookupInfo.InfoFactoryClass = this.InfoFactoryClass; + if (lookupInfo == null) + displayType = DisplayType.ID; + else + lookupInfo.InfoFactoryClass = this.InfoFactoryClass; } catch (Exception e) // Cannot create Lookup { diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index f9301b7a1f..0bd52d8d54 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -243,20 +243,19 @@ public class MQuery implements Serializable return "C_DocType_ID"; if (columnName.equals("Bill_BPartner_ID")) return "C_BPartner_ID"; - if (columnName.equals("Bill_Location_ID")) + if (columnName.equals("Bill_Location_ID") || columnName.equals("BillTo_ID")) return "C_BPartner_Location_ID"; if (columnName.equals("Account_ID")) return "C_ElementValue_ID"; if (columnName.equals("C_LocFrom_ID") || columnName.equals("C_LocTo_ID")) return "C_Location_ID"; - // Fix "*_To" columns - if (columnName.toUpperCase().endsWith("TO_ID")) { - return columnName.substring(0, columnName.length()-5)+"_ID"; - } - if (columnName.toUpperCase().endsWith("_TO_ID")) { - return columnName.substring(0, columnName.length()-6)+"_ID"; - } - if (columnName.equals("AD_OrgBP_ID") || columnName.equals("AD_OrgTrx_ID")) + if (columnName.equals("C_UOM_To_ID")) + return "C_UOM"; + if (columnName.equals("M_AttributeSetInstanceTo_ID")) + return "M_AttributeSetInstance"; + if (columnName.equals("M_LocatorTo_ID")) + return "M_Locator"; + if (columnName.equals("AD_OrgBP_ID") || columnName.equals("AD_OrgTrx_ID") || columnName.equals("AD_OrgTo_ID")) return "AD_Org_ID"; // See also GridTab.validateQuery //