[Reservations]Do not consider Draft status as reserved stock.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Mon, 12 Nov 2012 18:42:01 +0100
changeset 18694 57becadd32b4
parent 18693 7b17189c848b
child 18695 f584300636c8
[Reservations]Do not consider Draft status as reserved stock.
src-db/database/model/functions/M_GET_STOCK.xml
src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml
--- a/src-db/database/model/functions/M_GET_STOCK.xml	Mon Nov 12 18:05:28 2012 +0100
+++ b/src-db/database/model/functions/M_GET_STOCK.xml	Mon Nov 12 18:42:01 2012 +0100
@@ -213,7 +213,7 @@
                 AND rs.m_locator_id IS NOT NULL
                 AND rs.m_locator_id = COALESCE(v_locatorid, rs.m_locator_id)
                 AND COALESCE(rs.m_attributesetinstance_id, '0') = COALESCE(v_attributesetinstanceid, rs.m_attributesetinstance_id, '0')
-                AND r.res_status <> 'CL'
+                AND r.res_status NOT IN ('CL', 'DR')
                 AND ((v_reservation_id IS NOT NULL AND rs.isallocated = 'Y')
                     OR v_reservation_id IS NULL)
               GROUP BY r.m_product_id, r.c_uom_id, rs.m_locator_id, COALESCE(rs.m_attributesetinstance_id, '0')
--- a/src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml	Mon Nov 12 18:05:28 2012 +0100
+++ b/src-db/database/model/functions/M_RESERVATION_CONSUMPTION.xml	Mon Nov 12 18:42:01 2012 +0100
@@ -93,7 +93,7 @@
         FROM m_reservation_stock rs
           JOIN m_reservation r ON rs.m_reservation_id = r.m_reservation_id
         WHERE r.m_product_id = v_product_id
-          AND r.res_status NOT IN ('CL')
+          AND r.res_status NOT IN ('CL', 'DR')
           AND r.c_uom_id = v_uom_id
           AND rs.m_locator_id = p_locator_id
           AND COALESCE(rs.m_attributesetinstance_id, '0') = COALESCE(p_attributesetinstance_id, '0')
@@ -209,7 +209,7 @@
         AND rs.m_locator_id = p_locator_id
         AND COALESCE(rs.m_attributesetinstance_id, '0') = COALESCE(p_attributesetinstance_id, '0')
         AND rs.isallocated = 'N'
-        AND r.res_status NOT IN ('HO', 'CL')
+        AND r.res_status NOT IN ('HO', 'CL', 'DR')
         AND rs.quantity != rs.releasedqty
   ) LOOP
     v_qtytorelease := LEAST(v_pendingtorelease, cur_not_allocated_stock.quantity - cur_not_allocated_stock.releasedqty);