diff --git a/base/src/org/compiere/model/CalloutInvoice.java b/base/src/org/compiere/model/CalloutInvoice.java index 2e05b0b229..b9f9b2ce0d 100644 --- a/base/src/org/compiere/model/CalloutInvoice.java +++ b/base/src/org/compiere/model/CalloutInvoice.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -296,7 +296,14 @@ public class CalloutInvoice extends CalloutEngine // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); - int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // globalqss - fix reported bug [ 1643489 ] PriceListVersion misfunctionality + int M_PriceList_Version_ID; + // try to get the price list version from info product tab + M_PriceList_Version_ID = Env.getContextAsInt(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_PriceList_Version_ID"); + // if not found try to get from the context of window + if (M_PriceList_Version_ID == 0) + M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // end globalqss pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced"); pp.setPriceDate(date); @@ -490,7 +497,14 @@ public class CalloutInvoice extends CalloutEngine boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx); pp.setM_PriceList_ID(M_PriceList_ID); - int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // globalqss - fix reported bug [ 1643489 ] PriceListVersion misfunctionality + int M_PriceList_Version_ID; + // try to get the price list version from info product tab + M_PriceList_Version_ID = Env.getContextAsInt(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_PriceList_Version_ID"); + // if not found try to get from the context of window + if (M_PriceList_Version_ID == 0) + M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // end globalqss pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); Timestamp date = (Timestamp)mTab.getValue("DateInvoiced"); pp.setPriceDate(date); diff --git a/base/src/org/compiere/model/CalloutOrder.java b/base/src/org/compiere/model/CalloutOrder.java index f8a41717ad..36a1b2337b 100644 --- a/base/src/org/compiere/model/CalloutOrder.java +++ b/base/src/org/compiere/model/CalloutOrder.java @@ -661,7 +661,14 @@ public class CalloutOrder extends CalloutEngine int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); /** PLV is only accurate if PL selected in header */ - int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // globalqss - fix reported bug [ 1643489 ] PriceListVersion misfunctionality + int M_PriceList_Version_ID; + // try to get the price list version from info product tab + M_PriceList_Version_ID = Env.getContextAsInt(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_PriceList_Version_ID"); + // if not found try to get from the context of window + if (M_PriceList_Version_ID == 0) + M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // end globalqss pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered"); pp.setPriceDate(orderDate); @@ -916,7 +923,14 @@ public class CalloutOrder extends CalloutEngine boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx); pp.setM_PriceList_ID(M_PriceList_ID); - int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // globalqss - fix reported bug [ 1643489 ] PriceListVersion misfunctionality + int M_PriceList_Version_ID; + // try to get the price list version from info product tab + M_PriceList_Version_ID = Env.getContextAsInt(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_PriceList_Version_ID"); + // if not found try to get from the context of window + if (M_PriceList_Version_ID == 0) + M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); + // end globalqss pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); Timestamp date = (Timestamp)mTab.getValue("DateOrdered"); pp.setPriceDate(date);