Fixed Issue 20466: M_GET_STOCK function should also take into account
authorRafa de Miguel <rafael.demiguel@openbravo.com>
Fri, 11 May 2012 10:31:58 +0200
changeset 16493 6fef658096a2
parent 16492 b53dc1683c2c
child 16494 f789211d10bf
Fixed Issue 20466: M_GET_STOCK function should also take into account
src-db/database/model/functions/M_GET_STOCK.xml
--- a/src-db/database/model/functions/M_GET_STOCK.xml	Fri May 11 01:24:29 2012 +0200
+++ b/src-db/database/model/functions/M_GET_STOCK.xml	Fri May 11 10:31:58 2012 +0200
@@ -148,7 +148,7 @@
         AND COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '-1') = COALESCE(v_AttributesetinstanceID, T.M_ATTRIBUTESETINSTANCE_ID, '-1')
         AND COALESCE(L.M_LOCATOR_ID, '-1') = COALESCE(v_LocatorID, L.M_LOCATOR_ID, '-1')
         AND COALESCE(W.M_WAREHOUSE_ID, '-1') = COALESCE(v_WarehouseID, W.M_WAREHOUSE_ID, '-1')
-        AND AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1
+        AND ((AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1) OR (AD_ISORGINCLUDED(v_OrgID,W.AD_ORG_ID,W.AD_CLIENT_ID)<>-1))
         AND COALESCE(MS.Quantity, 0)>0
         ORDER BY PRIORITYNO, LASTUPDATED
       )
@@ -184,7 +184,7 @@
         AND COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '-1') = COALESCE(v_AttributesetinstanceID, T.M_ATTRIBUTESETINSTANCE_ID, '-1')
         AND COALESCE(L.M_LOCATOR_ID, '-1') = COALESCE(v_LocatorID, L.M_LOCATOR_ID, '-1')
         AND COALESCE(W.M_WAREHOUSE_ID, '-1') = COALESCE(v_WarehouseID, W.M_WAREHOUSE_ID, '-1')
-        AND AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1
+        AND ((AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1) OR (AD_ISORGINCLUDED(v_OrgID,W.AD_ORG_ID,W.AD_CLIENT_ID)<>-1))
         AND COALESCE(T.QtyOnHand, 0)>0
         ORDER BY PRIORITYNO, LASTUPDATED
       )