IDEMPIERE-1183 Info Invoice window not setting Sales Trx flag / Based on patch from Richard Morales

This commit is contained in:
Carlos Ruiz 2013-08-04 21:27:13 -05:00
parent 099e1bf880
commit c59cc58eed
1 changed files with 13 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import org.adempiere.webui.panel.InfoPaymentPanel;
import org.adempiere.webui.panel.InfoProductPanel; import org.adempiere.webui.panel.InfoProductPanel;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MDocType;
import org.compiere.model.MInfoWindow; import org.compiere.model.MInfoWindow;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -49,11 +50,12 @@ public class DefaultInfoFactory implements IInfoFactory {
public InfoPanel create(int WindowNo, String tableName, String keyColumn, public InfoPanel create(int WindowNo, String tableName, String keyColumn,
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup) { String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup) {
InfoPanel info = null; InfoPanel info = null;
setSOTrxBasedOnDocType(WindowNo);
if (tableName.equals("C_BPartner")) { if (tableName.equals("C_BPartner")) {
info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup); info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup);
if (!info.loadedOK()) { 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); multiSelection, whereClause, lookup);
} }
} else if (tableName.equals("M_Product")) { } else if (tableName.equals("M_Product")) {
@ -123,6 +125,7 @@ public class DefaultInfoFactory implements IInfoFactory {
String keyColumn, String queryValue, boolean multiSelection, String keyColumn, String queryValue, boolean multiSelection,
String whereClause, int AD_InfoWindow_ID) { String whereClause, int AD_InfoWindow_ID) {
InfoPanel info = null; InfoPanel info = null;
setSOTrxBasedOnDocType(lookup.getWindowNo());
String col = lookup.getColumnName(); // fully qualified name String col = lookup.getColumnName(); // fully qualified name
@ -182,4 +185,12 @@ public class DefaultInfoFactory implements IInfoFactory {
return null; 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");
}
}
} }