From 7e1bfa1334cd3d416e984444814c3b43ccb94d17 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 8 Jun 2023 05:33:02 +0200 Subject: [PATCH] IDEMPIERE-5766 Recreate Storage Reservation is creating records for non-stocked products (#1892) --- .../process/RecreateStorageReservation.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/process/RecreateStorageReservation.java b/org.adempiere.base/src/org/adempiere/process/RecreateStorageReservation.java index 29aaa30e37..407a28762c 100644 --- a/org.adempiere.base/src/org/adempiere/process/RecreateStorageReservation.java +++ b/org.adempiere.base/src/org/adempiere/process/RecreateStorageReservation.java @@ -37,20 +37,21 @@ public class RecreateStorageReservation extends SvrProcess { + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, " + " ol.M_Warehouse_ID, " + " ol.M_Product_ID, " - + " COALESCE(M_AttributeSetInstance_ID, 0) AS M_AttributeSetInstance_ID, " + + " COALESCE(ol.M_AttributeSetInstance_ID, 0) AS M_AttributeSetInstance_ID, " + " o.IsSOTrx, " + " w.AD_Client_ID, " + " w.AD_Org_ID " + "FROM C_OrderLine ol " + " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) " + " JOIN M_Warehouse w ON ( w.M_Warehouse_ID = o.M_Warehouse_ID ) " - + "WHERE ol.m_product_ID > 0 " - + " AND ol.ad_client_ID = ? " - + " AND ol.qtyreserved != 0 " - + " AND o.docstatus NOT IN ( 'VO', 'RE' ) " + + " JOIN M_Product p ON ( p.M_Product_ID = ol.M_Product_ID ) " + + "WHERE ol.AD_Client_ID = ? " + + " AND p.IsStocked='Y' " + + " AND ol.QtyReserved != 0 " + + " AND o.DocStatus NOT IN ( 'VO', 'RE' ) " + "GROUP BY ol.M_Warehouse_ID, " + " ol.M_Product_ID, " - + " COALESCE(M_AttributeSetInstance_ID, 0), " + + " COALESCE(ol.M_AttributeSetInstance_ID, 0), " + " o.IsSOTrx, " + " w.AD_Client_ID, " + " w.AD_Org_ID " @@ -102,7 +103,7 @@ public class RecreateStorageReservation extends SvrProcess { + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, " + " ol.M_Warehouse_ID, " + " ol.M_Product_ID, " - + " COALESCE(M_AttributeSetInstance_ID, 0), " + + " COALESCE(ol.M_AttributeSetInstance_ID, 0), " + " o.IsSOTrx, " + " w.AD_Client_ID, " + " w.AD_Org_ID, " @@ -115,13 +116,14 @@ public class RecreateStorageReservation extends SvrProcess { + "FROM C_OrderLine ol " + " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) " + " JOIN M_Warehouse w ON ( w.M_Warehouse_ID = o.M_Warehouse_ID ) " - + "WHERE ol.M_Product_ID > 0 " + + " JOIN M_Product p ON ( p.M_Product_ID = ol.M_Product_ID ) " + + "WHERE p.IsStocked='Y' " + " AND ol.QtyReserved != 0 " + " AND o.DocStatus NOT IN ( 'VO', 'RE' ) " + " AND o.AD_Client_ID = ? " + "GROUP BY ol.M_Warehouse_ID, " + " ol.M_Product_ID, " - + " COALESCE(M_AttributeSetInstance_ID, 0), " + + " COALESCE(ol.M_AttributeSetInstance_ID, 0), " + " o.IsSOTrx, " + " w.AD_Client_ID, " + " w.AD_Org_ID";