Fixes issue 20408: Manufacturing planning not work with product where safety stock is null or 0
authorJavier Etxarri <javier.echarri@openbravo.com>
Thu, 03 May 2012 17:06:19 +0200
changeset 16517 66f6c21ba5dc
parent 16516 21fc11601168
child 16518 35a1ec14c74d
Fixes issue 20408: Manufacturing planning not work with product where safety stock is null or 0
src-db/database/model/functions/MRP_RUN_INITIALIZE.xml
--- a/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Fri May 04 12:31:22 2012 +0200
+++ b/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Thu May 03 17:06:19 2012 +0200
@@ -214,8 +214,9 @@
 
         IF (v_Count = 0) THEN -- First time on this product
           v_ResultStr := 'Inserting stock lines product: ' || Cur_Product.M_Product_ID;
-          Mrp_Run_Insertlines(p_Client_ID, p_Org_ID, p_User_ID, p_Run, Cur_Product.M_Product_ID, (-1 * Cur_Product.STOCKMIN), 0, NULL, 'MS', 'Y', NULL, NULL, NULL, NULL, NULL, p_PlanningDate, NULL, p_Production, 'N', NULL, v_Aux_ID);
-          Mrp_Run_Insertlines(p_Client_ID, p_Org_ID, p_User_ID, p_Run, Cur_Product.M_Product_ID, v_QtyOnHand, 0, NULL, 'ST', 'Y', NULL, NULL, NULL, NULL, NULL, p_PlanningDate, NULL, p_Production, 'Y', NULL, v_Aux_ID);
+
+          Mrp_Run_Insertlines(p_Client_ID, p_Org_ID, p_User_ID, p_Run, Cur_Product.M_Product_ID, (-1 * Cur_Product.STOCKMIN), 0, NULL, 'MS', 'Y', NULL, NULL, NULL, NULL, NULL, p_PlanningDate, NULL, p_Production, (CASE WHEN Cur_Product.STOCKMIN > 0 THEN 'N' ELSE 'Y' END), NULL, v_Aux_ID);
+	  Mrp_Run_Insertlines(p_Client_ID, p_Org_ID, p_User_ID, p_Run, Cur_Product.M_Product_ID, v_QtyOnHand, 0, NULL, 'ST', 'Y', NULL, NULL, NULL, NULL, NULL, p_PlanningDate, NULL, p_Production, 'Y', NULL, v_Aux_ID);
 
           v_ResultStr := 'Inserting Order lines product: ' || Cur_Product.M_Product_ID;
           FOR Cur_OrderLine IN (SELECT Mrp_Check_Planningmethod(Cur_Product.MRP_PlanningMethod_ID,