Fixes issue 24978: Impossible to process a purchase order in one case
authorPandeeswari Ramakrishnan <pandeeswari.ramakrishnan@openbravo.com>
Mon, 21 Oct 2013 16:43:50 +0530
changeset 21335 2b3722a3880c
parent 21334 13592cad431f
child 21336 5111ac3f94f0
Fixes issue 24978: Impossible to process a purchase order in one case
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	Mon Oct 21 11:09:29 2013 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Mon Oct 21 16:43:50 2013 +0530
@@ -204,7 +204,7 @@
     WHERE M_Warehouse_ID=v_M_Warehouse_ID
     AND AD_Org_ID = v_Org_ID;
 
-    IF v_count = 0 THEN
+    IF v_count = 0 AND v_IsSOTrx = 'Y' THEN
     RAISE_APPLICATION_ERROR(-20000,'@WrongWarehouse@') ;
     END IF;
 
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Mon Oct 21 11:09:29 2013 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Mon Oct 21 16:43:50 2013 +0530
@@ -93,6 +93,7 @@
     Cur_MILines RECORD;
     FINISH_PROCESS BOOLEAN:=false;
     v_Aux NUMBER;
+    v_isSoTrx CHAR(1);
     v_ProductName M_Product.name%TYPE;
     v_reservation_id    VARCHAR2(32);
     v_M_Warehouse_ID    VARCHAR2(32);
@@ -149,8 +150,8 @@
   BEGIN --BODY
   	IF(NOT FINISH_PROCESS) THEN
   	  v_PUser:=v_User;
-      SELECT io.AD_Client_ID, io.AD_Org_ID, io.CreatedBy, io.C_DocType_ID, io.DateAcct, dt.isreturn, io.m_warehouse_id
-        INTO v_AD_Client_ID, v_AD_Org_ID, v_User, v_DocType_ID, v_DateAcct, v_isreturndoctype, v_M_Warehouse_ID
+      SELECT io.AD_Client_ID, io.AD_Org_ID, io.CreatedBy, io.C_DocType_ID, io.DateAcct, dt.isreturn, io.m_warehouse_id, io.issotrx
+        INTO v_AD_Client_ID, v_AD_Org_ID, v_User, v_DocType_ID, v_DateAcct, v_isreturndoctype, v_M_Warehouse_ID, v_isSoTrx
         FROM M_InOut io JOIN c_doctype dt ON io.c_doctype_id = dt.c_doctype_id
         WHERE io.M_InOut_ID=v_Record_ID;
         IF(v_PUser IS NOT NULL) THEN
@@ -182,7 +183,7 @@
       WHERE M_Warehouse_ID=v_M_Warehouse_ID
       AND AD_Org_ID = v_AD_Org_ID;
 
-      IF v_count = 0 THEN
+      IF v_count = 0 AND v_isSoTrx = 'Y' THEN
         RAISE_APPLICATION_ERROR(-20000,'@WrongWarehouse@');
       END IF;