details:   https://code.openbravo.com/erp/devel/pi/rev/4d91babc9e09
changeset: 21237:4d91babc9e09
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Fri Oct 04 14:50:09 2013 +0200
summary:   Fixes issue 24509: Reservation Consupmtion doesn't work on certain 
cases

diffstat:

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

diffs (36 lines):

diff -r 593a694408a7 -r 4d91babc9e09 
src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml
--- a/src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml     Fri Oct 
04 08:28:33 2013 +0200
+++ b/src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml     Fri Oct 
04 14:50:09 2013 +0200
@@ -234,27 +234,29 @@
             FROM m_reservation_stock
             WHERE m_reservation_id = p_reservation_id
               AND isallocated = 'N'
+              AND ((m_attributesetinstance_id != p_attributesetinstance_id OR 
m_attributesetinstance_id is null) OR m_locator_id != p_locator_id)
               AND quantity != COALESCE(releasedqty,0)
         ) LOOP
+
           v_qtytounreserve_aux := LEAST(v_qtytounreserve, 
cur_reserved_stock.reservedqty);
           UPDATE m_reservation_stock
           SET quantity = quantity - v_qtytounreserve_aux
           WHERE m_reservation_stock_id = 
cur_reserved_stock.m_reservation_stock_id;
           v_qtytounreserve := v_qtytounreserve - v_qtytounreserve_aux;
-  
+
           IF (v_qtytounreserve = 0) THEN
             EXIT;
           END IF;
         END LOOP;
       END IF;
-      
+
       UPDATE m_reservation_stock
       SET quantity = quantity - v_qtytorelease
       WHERE m_reservation_stock_id = 
cur_not_allocated_stock.m_reservation_stock_id;
       DELETE FROM m_reservation_stock
       WHERE quantity = 0
         AND m_reservation_stock_id = 
cur_not_allocated_stock.m_reservation_stock_id;
-  
+        
       M_RESERVE_STOCK_MANUAL(p_reservation_id, 'SD', v_storage_detail_id, 
v_qtytorelease, p_user_id, 'N', v_res_stock_id);
   
       -- Call get stock to check availability

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to