From c59cc58eedf689e54819e85e28aa89c8a5441888 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 4 Aug 2013 21:27:13 -0500 Subject: [PATCH] IDEMPIERE-1183 Info Invoice window not setting Sales Trx flag / Based on patch from Richard Morales --- .../webui/factory/DefaultInfoFactory.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultInfoFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultInfoFactory.java index f93a0cd528..b868cbaebc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultInfoFactory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultInfoFactory.java @@ -35,6 +35,7 @@ import org.adempiere.webui.panel.InfoPaymentPanel; import org.adempiere.webui.panel.InfoProductPanel; import org.compiere.model.GridField; import org.compiere.model.Lookup; +import org.compiere.model.MDocType; import org.compiere.model.MInfoWindow; import org.compiere.util.Env; @@ -49,11 +50,12 @@ public class DefaultInfoFactory implements IInfoFactory { public InfoPanel create(int WindowNo, String tableName, String keyColumn, String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup) { InfoPanel info = null; + setSOTrxBasedOnDocType(WindowNo); if (tableName.equals("C_BPartner")) { info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup); if (!info.loadedOK()) { - info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"), + info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx").equals("N"), multiSelection, whereClause, lookup); } } else if (tableName.equals("M_Product")) { @@ -123,7 +125,8 @@ public class DefaultInfoFactory implements IInfoFactory { String keyColumn, String queryValue, boolean multiSelection, String whereClause, int AD_InfoWindow_ID) { InfoPanel info = null; - + setSOTrxBasedOnDocType(lookup.getWindowNo()); + String col = lookup.getColumnName(); // fully qualified name if (col.indexOf('.') != -1) @@ -182,4 +185,12 @@ public class DefaultInfoFactory implements IInfoFactory { return null; } + private void setSOTrxBasedOnDocType(int WindowNo) { + int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "C_DocType_ID"); + if (C_DocType_ID != 0) { + MDocType dt = MDocType.get (Env.getCtx(), C_DocType_ID); + Env.setContext(Env.getCtx(), WindowNo, "IsSOTrx", dt.isSOTrx () ? "Y": "N"); + } + } + }