details:   https://code.openbravo.com/erp/devel/pi/rev/708d0981673d
changeset: 32611:708d0981673d
user:      Mark <markmm82 <at> gmail.com>
date:      Fri Sep 01 12:26:19 2017 -0400
summary:   Fixes issue 36690: Insufficient stock in Create Standards Process of 
Work Effort

When Create Standards Process of Work Effort - Production Run tab was executed
if stock is in different priority warehouses, an error message Insufficient 
stock
is shown even if there is stock of the product.

Problem was that in M_GET_STOCK_PARAM function v_qtyaux is decreased on each 
loop
and v_finalqty is taking into account stock in warehouses of the same priority 
than
currently analyzed, when v_qtyaux is updated always is subtracted the sum of
m_stock_proposed lines with priority less or equal than current and it is wrong.

Solution is always compare the requested quantity (v_quantity) with sum of 
quantities
from m_stock_proposed lines with priority less or equal than current iteration.

diffstat:

 src-db/database/model/functions/M_GET_STOCK_PARAM.xml |  4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diffs (21 lines):

diff -r 62f82f265b39 -r 708d0981673d 
src-db/database/model/functions/M_GET_STOCK_PARAM.xml
--- a/src-db/database/model/functions/M_GET_STOCK_PARAM.xml     Fri Sep 01 
13:23:45 2017 +0200
+++ b/src-db/database/model/functions/M_GET_STOCK_PARAM.xml     Fri Sep 01 
12:26:19 2017 -0400
@@ -420,7 +420,6 @@
     v_finalqty NUMBER;
     v_totalqty NUMBER;
     v_availableqty NUMBER;
-    v_qtyaux NUMBER:=v_quantity;
     v_AuxResult NUMBER;
     v_AuxMessage VARCHAR2(2000):='';
     v_productname M_PRODUCT.NAME%TYPE;
@@ -587,8 +586,7 @@
       WHERE ad_pinstance_id = p_uuid
         AND priority <= cur_warehouse.priority
         AND isfinal = 'Y';
-      v_qtyaux := v_qtyaux - v_finalqty;
-      IF (v_qtyaux <= 0) THEN
+      IF (v_quantity - v_finalqty <= 0) THEN
         DELETE FROM m_stock_proposed
         WHERE ad_pinstance_id = p_uuid
           AND (priority > cur_warehouse.priority

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to