src-db/database/model/functions/M_INOUT_POST.xml
changeset 21373 e3a359452601
parent 21367 30007fa0089d
child 21778 d7f5fe16e748
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Wed Oct 23 12:24:02 2013 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Mon Oct 21 17:23:59 2013 +0530
@@ -69,6 +69,7 @@
     --
     v_Result NUMBER:=1;
     v_AD_Org_ID VARCHAR2(32);
+    v_Warehouse_Org VARCHAR2(32);
     v_AD_Client_ID VARCHAR2(32);
     v_NextNo VARCHAR2(32);
     v_Qty NUMBER;
@@ -187,6 +188,15 @@
         RAISE_APPLICATION_ERROR(-20000,'@WrongWarehouse@');
       END IF;
 
+      SELECT AD_Org_ID
+      INTO v_Warehouse_Org
+      FROM M_Warehouse
+      WHERE M_Warehouse_ID = v_M_Warehouse_ID;
+
+      IF(ad_org_isinnaturaltree(v_Warehouse_Org, v_AD_Org_ID, v_AD_Client_ID) = 'N' AND v_isSoTrx = 'N') THEN
+        RAISE_APPLICATION_ERROR(-20000,'@WrongWarehouse@');
+      END IF;
+
       SELECT CASE WHEN (m.ISSOTRX='Y') THEN customer_blocking ELSE vendor_blocking END, CASE WHEN (m.ISSOTRX='Y') 
       THEN so_goods_blocking ELSE po_goods_blocking END, name, DocAction
       INTO v_bpartner_blocked, v_goods_blocked, v_bpartner_name, v_DocAction