Fixes Issue 24979: Warehouses that should be available in purchase transactions
authorPandeeswari Ramakrishnan <pandeeswari.ramakrishnan@openbravo.com>
Mon, 21 Oct 2013 17:23:59 +0530
changeset 21373 e3a359452601
parent 21372 ae421dd5cfd8
child 21374 af69b7e7a6c8
Fixes Issue 24979: Warehouses that should be available in purchase transactions
src-db/database/model/functions/C_ORDER_POST1.xml
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Wed Oct 23 12:24:02 2013 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Mon Oct 21 17:23:59 2013 +0530
@@ -42,6 +42,7 @@
   -- Record Info
   v_Client_ID VARCHAR2(32);
   v_Org_ID VARCHAR2(32);
+  v_Warehouse_Org VARCHAR2(32);
   v_Org_Name VARCHAR2(60);
   v_UpdatedBy VARCHAR2(32);
   v_DocAction VARCHAR(60) ;
@@ -208,6 +209,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_Org_ID, v_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_order_blocking ELSE po_order_blocking  END, name, DocAction
       INTO v_bpartner_blocked, v_orderBlocking, v_bpartner_name, v_DocAction
--- 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