Fixes BUG-42421: Exception in Run Order Confirmation process
authorÁlvaro Ferraz <alvaro.ferraz@openbravo.com>
Mon, 02 Dec 2019 10:14:23 +0100
changeset 36844 2861c11135dd
parent 36843 5a438a7a4de3
child 36845 7452c8180172
Fixes BUG 42421: Exception in Run Order Confirmation process

The Run Order Confirmation process throw an exception when the Business Partner
does not belongs to the same Order organization

The check was updated to take into account the transaction organization.
src-db/database/model/functions/C_INVOICE_POST.xml
src-db/database/model/functions/C_ORDER_POST1.xml
--- a/src-db/database/model/functions/C_INVOICE_POST.xml	Thu Nov 14 15:47:30 2019 +0100
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Mon Dec 02 10:14:23 2019 +0100
@@ -22,7 +22,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2018 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2019 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -1114,6 +1114,7 @@
       FROM C_INVOICE c, C_BPARTNER bp
       WHERE c.C_BPARTNER_ID=bp.C_BPARTNER_ID
         AND Ad_Isorgincluded(c.AD_ORG_ID, bp.AD_ORG_ID, bp.AD_CLIENT_ID)=-1
+        AND Ad_Isorgincluded(c.AD_ORGTRX_ID, bp.AD_ORG_ID, bp.AD_CLIENT_ID)=-1
         AND c.C_Invoice_ID=v_Record_ID;
       IF (v_count>0) THEN
         RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgBpartnerInvoice@') ;
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Thu Nov 14 15:47:30 2019 +0100
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Mon Dec 02 10:14:23 2019 +0100
@@ -964,7 +964,8 @@
         FROM C_ORDER c, C_BPARTNER bp
         WHERE c.C_Order_ID=v_Record_ID
           AND c.C_BPARTNER_ID=bp.C_BPARTNER_ID
-          AND Ad_Isorgincluded(c.AD_ORG_ID, bp.AD_ORG_ID, bp.AD_CLIENT_ID)=-1;
+          AND Ad_Isorgincluded(c.AD_ORG_ID, bp.AD_ORG_ID, bp.AD_CLIENT_ID)=-1
+          AND Ad_Isorgincluded(c.AD_ORGTRX_ID, bp.AD_ORG_ID, bp.AD_CLIENT_ID)=-1;
         IF (v_count > 0) THEN
           RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgBpartnerOrder@') ;
         END IF;