Fixes issue 19436: Manufacturing planning does not
authorJavier Etxarri <javier.echarri@openbravo.com>
Tue, 28 Feb 2012 17:45:56 +0100
changeset 15640 d4d191fb59ab
parent 15639 eace38eb23f3
child 15641 1ac5c5ca6841
Fixes issue 19436: Manufacturing planning does not
take into account safety stock as minimum requirement unless there is demand
src-db/database/model/functions/MRP_PROCESSPLAN_PLAN.xml
src-db/database/model/functions/MRP_RUN_INITIALIZE.xml
--- a/src-db/database/model/functions/MRP_PROCESSPLAN_PLAN.xml	Tue Feb 28 17:45:16 2012 +0100
+++ b/src-db/database/model/functions/MRP_PROCESSPLAN_PLAN.xml	Tue Feb 28 17:45:56 2012 +0100
@@ -105,7 +105,7 @@
         END IF;
       END IF;
       v_Stock := v_Stock + v_Qty_New;
-      IF (Cur_Lines.INOUTTRXTYPE IN ('ST', 'MS') OR Cur_Lines.qty >=0) THEN
+      IF (Cur_Lines.INOUTTRXTYPE IN ('ST') OR Cur_Lines.qty >=0) THEN
         v_availablestock := v_AvailableStock + v_qty_new + COALESCE(Cur_Lines.demandqty, 0);
       END IF;
       UPDATE MRP_RUN_PRODUCTIONLINE
--- a/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Tue Feb 28 17:45:16 2012 +0100
+++ b/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Tue Feb 28 17:45:56 2012 +0100
@@ -172,7 +172,7 @@
 
         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, '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, 'N', NULL, v_Aux_ID);
           Mrp_Run_Insertlines(p_Client_ID, p_Org_ID, p_User_ID, p_Run, Cur_Product.M_Product_ID, Cur_Product.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;