diff --git a/base/src/org/compiere/wf/MWorkflow.java b/base/src/org/compiere/wf/MWorkflow.java index 3a0e0482a2..543b76761c 100644 --- a/base/src/org/compiere/wf/MWorkflow.java +++ b/base/src/org/compiere/wf/MWorkflow.java @@ -940,9 +940,9 @@ public class MWorkflow extends X_AD_Workflow * @param M_Product_ID * @return AD_Workflow_ID */ - public static int getWorkflowSearchKey(Properties ctx, MProduct product) + public static int getWorkflowSearchKey(MProduct product) { - int AD_Client_ID = Env.getAD_Client_ID(ctx); + int AD_Client_ID = Env.getAD_Client_ID(product.getCtx()); String sql = "SELECT AD_Workflow_ID FROM AD_Workflow " +" WHERE Value = ? AND AD_Client_ID = ?"; return DB.getSQLValue(null, sql, product.getValue(), AD_Client_ID); diff --git a/base/src/org/eevolution/model/CalloutOrder.java b/base/src/org/eevolution/model/CalloutOrder.java index 0745178529..52fe806dc5 100644 --- a/base/src/org/eevolution/model/CalloutOrder.java +++ b/base/src/org/eevolution/model/CalloutOrder.java @@ -55,12 +55,11 @@ public class CalloutOrder extends CalloutEngine { if (value == null) return ""; - //setCalloutActive(true); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); if (steps) log.warning("qty - init - M_Product_ID=" + M_Product_ID + " - " ); BigDecimal QtyOrdered = Env.ZERO ; - BigDecimal QtyEntered = Env.ZERO ; //, PriceActual, PriceEntered; + BigDecimal QtyEntered = Env.ZERO ; // No Product if (M_Product_ID == 0) @@ -154,12 +153,17 @@ public class CalloutOrder extends CalloutEngine MProduct product = MProduct.get(ctx, ((Number)value).intValue()); if (product == null) return ""; + mTab.setValue(MProduct.COLUMNNAME_C_UOM_ID,product.getC_UOM_ID()); - int workflow_id = MWorkflow.getWorkflowSearchKey(ctx, product); + int workflow_id = MWorkflow.getWorkflowSearchKey(product); mTab.setValue(MPPOrder.COLUMNNAME_AD_Workflow_ID, workflow_id > 0 ? workflow_id : null); - int bom_id = MPPProductBOM.getBOMSearchKey(ctx, product); - mTab.setValue(MPPOrder.COLUMNNAME_PP_Product_BOM_ID, bom_id > 0 ? bom_id : null); + MPPProductBOM bom = MPPProductBOM.getDefault(product, null); + if (bom == null) + return ""; + + mTab.setValue(MPPOrder.COLUMNNAME_PP_Product_BOM_ID, bom.get_ID()); + mTab.setValue(MPPOrder.COLUMNNAME_C_UOM_ID,bom.getC_UOM_ID()); return ""; } diff --git a/base/src/org/eevolution/model/MPPMRP.java b/base/src/org/eevolution/model/MPPMRP.java index 12d00532ba..140199741a 100644 --- a/base/src/org/eevolution/model/MPPMRP.java +++ b/base/src/org/eevolution/model/MPPMRP.java @@ -406,7 +406,7 @@ public class MPPMRP extends X_PP_MRP //TODO: vpj-cd create the msg for error throw new AdempiereException("Do not exist Resource Plant for this Warehouse"); } - MWorkflow workflow = MWorkflow.get(ol.getCtx(), MWorkflow.getWorkflowSearchKey(ol.getCtx(), product)); + MWorkflow workflow = MWorkflow.get(ol.getCtx(), MWorkflow.getWorkflowSearchKey(product)); //Validate the workflow based in planning data if(workflow == null && pp != null) { diff --git a/base/src/org/eevolution/model/MPPOrderBOMLine.java b/base/src/org/eevolution/model/MPPOrderBOMLine.java index 0fd3dfb1e4..4af3019fd8 100644 --- a/base/src/org/eevolution/model/MPPOrderBOMLine.java +++ b/base/src/org/eevolution/model/MPPOrderBOMLine.java @@ -155,7 +155,7 @@ public class MPPOrderBOMLine extends X_PP_Order_BOMLine if(m_qtyToExplode != null) { MProduct parent = MProduct.get(getCtx(), getM_Product_ID()); - int PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(getCtx(), parent); + int PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(parent); if (PP_Product_BOM_ID <= 0) { return true; diff --git a/base/src/org/eevolution/model/MPPProductBOM.java b/base/src/org/eevolution/model/MPPProductBOM.java index 761fe0aae7..72a80de2d0 100644 --- a/base/src/org/eevolution/model/MPPProductBOM.java +++ b/base/src/org/eevolution/model/MPPProductBOM.java @@ -73,9 +73,9 @@ public class MPPProductBOM extends X_PP_Product_BOM * @param M_Product_ID * @return PP_Product_BOM_ID */ - public static int getBOMSearchKey(Properties ctx, MProduct product) + public static int getBOMSearchKey(MProduct product) { - int AD_Client_ID = Env.getAD_Client_ID(ctx); + int AD_Client_ID = Env.getAD_Client_ID(product.getCtx()); String sql = "SELECT PP_Product_BOM_ID FROM PP_Product_BOM" +" WHERE Value=? AND M_Product_ID=? AND AD_Client_ID=?"; return DB.getSQLValueEx(null, sql, product.getValue(), product.get_ID(), AD_Client_ID); @@ -91,6 +91,7 @@ public class MPPProductBOM extends X_PP_Product_BOM { return new Query(product.getCtx(), Table_Name, "M_Product_ID=? AND Value=?", trxName) .setParameters(new Object[]{product.getM_Product_ID(), product.getValue()}) + .setClient_ID() .first(); } diff --git a/base/src/org/eevolution/process/MRP.java b/base/src/org/eevolution/process/MRP.java index 2411397d37..6e2e3e1465 100644 --- a/base/src/org/eevolution/process/MRP.java +++ b/base/src/org/eevolution/process/MRP.java @@ -527,11 +527,11 @@ public class MRP extends SvrProcess //Find the BOM to this Product if (m_product_planning.getPP_Product_BOM_ID() <= 0 && product.isBOM()) { - m_product_planning.setPP_Product_BOM_ID(MPPProductBOM.getBOMSearchKey(getCtx(), product)); + m_product_planning.setPP_Product_BOM_ID(MPPProductBOM.getBOMSearchKey(product)); } if (m_product_planning.getAD_Workflow_ID() <= 0 && product.isBOM()) { - m_product_planning.setAD_Workflow_ID(MWorkflow.getWorkflowSearchKey(getCtx(), product)); + m_product_planning.setAD_Workflow_ID(MWorkflow.getWorkflowSearchKey(product)); } if (m_product_planning.getPlanner_ID() <= 0) { diff --git a/base/src/org/eevolution/process/RollupBillOfMaterial.java b/base/src/org/eevolution/process/RollupBillOfMaterial.java index f2ac655d80..b4cac38b10 100644 --- a/base/src/org/eevolution/process/RollupBillOfMaterial.java +++ b/base/src/org/eevolution/process/RollupBillOfMaterial.java @@ -184,7 +184,7 @@ public class RollupBillOfMaterial extends SvrProcess } if (PP_Product_BOM_ID <= 0) { - PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(getCtx(), product); + PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(product); } if (PP_Product_BOM_ID <= 0) { diff --git a/base/src/org/eevolution/process/RollupWorkflow.java b/base/src/org/eevolution/process/RollupWorkflow.java index efe0e9be5c..b83aaf6ec2 100644 --- a/base/src/org/eevolution/process/RollupWorkflow.java +++ b/base/src/org/eevolution/process/RollupWorkflow.java @@ -138,7 +138,7 @@ public class RollupWorkflow extends SvrProcess } if (AD_Workflow_ID <= 0) { - AD_Workflow_ID = MWorkflow.getWorkflowSearchKey(getCtx(), product); + AD_Workflow_ID = MWorkflow.getWorkflowSearchKey(product); } if(AD_Workflow_ID <= 0) {