Fixes BUG-42573: Solves problem with lock in pricelist table
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 18 Dec 2019 10:30:37 +0530
changeset 36895 41b7178a6bd7
parent 36580 befde545395e
child 36896 005eb39e9993
Fixes BUG 42573: Solves problem with lock in pricelist table

* Remove join to pricelist table, that is not used, from the query
* Remove extra 'For Update' sentence, as the document and document tables
are alredy blocked by the first 'For Update' statement
src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml
src-db/database/model/functions/M_INOUTEXPLODEBOMNOTSTOCK.xml
src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml
--- a/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Mon Dec 02 06:26:02 2019 +0000
+++ b/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Wed Dec 18 10:30:37 2019 +0530
@@ -78,7 +78,8 @@
      
     SELECT C_ORDER.c_order_id, c_orderline.explode
       INTO v_orderID, v_explode
-    FROM C_ORDER JOIN m_pricelist ON c_order.m_pricelist_id = m_pricelist.m_pricelist_id JOIN c_orderline ON c_order.c_order_id = c_orderline.c_order_id
+    FROM C_ORDER
+      JOIN c_orderline ON c_order.c_order_id = c_orderline.c_order_id
     WHERE c_orderline.c_orderline_id=v_Record_ID  FOR UPDATE;
 
     IF (v_explode = 'Y') THEN
@@ -131,7 +132,7 @@
               AND p.IsBOM='Y'
               AND p.IsStocked='N' 
             )
-       ORDER BY l.Line  FOR UPDATE
+       ORDER BY l.Line
        )
     LOOP
       v_Line:=CUR_BOM_Line.Line;
--- a/src-db/database/model/functions/M_INOUTEXPLODEBOMNOTSTOCK.xml	Mon Dec 02 06:26:02 2019 +0000
+++ b/src-db/database/model/functions/M_INOUTEXPLODEBOMNOTSTOCK.xml	Wed Dec 18 10:30:37 2019 +0530
@@ -19,7 +19,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2013-2016 Openbravo SLU
+* All portions are Copyright (C) 2013-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -101,7 +101,7 @@
               AND p.IsBOM='Y'
               AND p.IsStocked='N'
             )
-       ORDER BY l.Line  FOR UPDATE
+       ORDER BY l.Line
        )
     LOOP
       v_Line:=CUR_BOM_Line.Line;
--- a/src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml	Mon Dec 02 06:26:02 2019 +0000
+++ b/src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml	Wed Dec 18 10:30:37 2019 +0530
@@ -74,7 +74,8 @@
      
     SELECT C_INVOICE.c_invoice_id, c_invoiceline.explode
       INTO v_invoiceID, v_explode
-    FROM C_INVOICE JOIN m_pricelist ON C_INVOICE.m_pricelist_id = m_pricelist.m_pricelist_id JOIN c_invoiceline ON C_INVOICE.c_invoice_id = c_invoiceline.c_invoice_id
+    FROM C_INVOICE
+      JOIN c_invoiceline ON C_INVOICE.c_invoice_id = c_invoiceline.c_invoice_id
     WHERE c_invoiceline.c_invoiceline_id=v_Record_ID  FOR UPDATE;
 
     IF (v_explode = 'Y') THEN
@@ -116,7 +117,7 @@
               AND p.IsBOM='Y'
               AND p.IsStocked='N'
             )
-       ORDER BY l.Line  FOR UPDATE
+       ORDER BY l.Line
        )
      LOOP
       v_Line:=CUR_BOM_Line.Line;