[Reservations]Fix issue in trigger.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Fri, 26 Oct 2012 12:09:02 +0200
changeset 18669 cd873d384798
parent 18668 fdde0ba22069
child 18670 1f4e85bd0e10
[Reservations]Fix issue in trigger.
src-db/database/model/triggers/M_TRANSACTION_TRG2.xml
--- a/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Fri Oct 26 11:09:13 2012 +0200
+++ b/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Fri Oct 26 12:09:02 2012 +0200
@@ -35,7 +35,8 @@
       WHERE EXISTS (SELECT 1
                     FROM m_reservation r
                         JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id
-                    WHERE r.m_product_id = :NEW.m_product_id
+                    WHERE r.res_status <> 'CL'
+                      AND r.m_product_id = :NEW.m_product_id
                       AND r.c_uom_id = :NEW.c_uom_id
                       AND COALESCE(rs.m_attributesetinstance_id, '0') = :NEW.m_attributesetinstance_id
                       AND rs.m_locator_id = :NEW.m_locator_id);
@@ -49,7 +50,7 @@
                                         AND COALESCE(rs.m_attributesetinstance_id, '0') = COALESCE(sd.m_attributesetinstance_id, '0')
                                         AND rs.m_locator_id = sd.m_locator_id
                                         AND sd.m_product_uom_id IS NULL
-        WHERE res_status <> 'CL'
+        WHERE r.res_status <> 'CL'
           AND r.m_product_id = :NEW.m_product_id
           AND r.c_uom_id = :NEW.c_uom_id
           AND COALESCE(rs.m_attributesetinstance_id, '0') = :NEW.m_attributesetinstance_id