IDEMPIERE-5766 Recreate Storage Reservation is creating records for non-stocked products (#1892)

This commit is contained in:
Carlos Ruiz 2023-06-08 05:33:02 +02:00 committed by GitHub
parent c9ccea5533
commit 7e1bfa1334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 9 deletions

View File

@ -37,20 +37,21 @@ public class RecreateStorageReservation extends SvrProcess {
+ "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, " + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, "
+ " ol.M_Warehouse_ID, " + " ol.M_Warehouse_ID, "
+ " ol.M_Product_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, " + " o.IsSOTrx, "
+ " w.AD_Client_ID, " + " w.AD_Client_ID, "
+ " w.AD_Org_ID " + " w.AD_Org_ID "
+ "FROM C_OrderLine ol " + "FROM C_OrderLine ol "
+ " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) " + " 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 ) " + " 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 ) "
+ " AND ol.ad_client_ID = ? " + "WHERE ol.AD_Client_ID = ? "
+ " AND ol.qtyreserved != 0 " + " AND p.IsStocked='Y' "
+ " AND o.docstatus NOT IN ( 'VO', 'RE' ) " + " AND ol.QtyReserved != 0 "
+ " AND o.DocStatus NOT IN ( 'VO', 'RE' ) "
+ "GROUP BY ol.M_Warehouse_ID, " + "GROUP BY ol.M_Warehouse_ID, "
+ " ol.M_Product_ID, " + " ol.M_Product_ID, "
+ " COALESCE(M_AttributeSetInstance_ID, 0), " + " COALESCE(ol.M_AttributeSetInstance_ID, 0), "
+ " o.IsSOTrx, " + " o.IsSOTrx, "
+ " w.AD_Client_ID, " + " w.AD_Client_ID, "
+ " w.AD_Org_ID " + " w.AD_Org_ID "
@ -102,7 +103,7 @@ public class RecreateStorageReservation extends SvrProcess {
+ "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, " + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, "
+ " ol.M_Warehouse_ID, " + " ol.M_Warehouse_ID, "
+ " ol.M_Product_ID, " + " ol.M_Product_ID, "
+ " COALESCE(M_AttributeSetInstance_ID, 0), " + " COALESCE(ol.M_AttributeSetInstance_ID, 0), "
+ " o.IsSOTrx, " + " o.IsSOTrx, "
+ " w.AD_Client_ID, " + " w.AD_Client_ID, "
+ " w.AD_Org_ID, " + " w.AD_Org_ID, "
@ -115,13 +116,14 @@ public class RecreateStorageReservation extends SvrProcess {
+ "FROM C_OrderLine ol " + "FROM C_OrderLine ol "
+ " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) " + " 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 ) " + " 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 ol.QtyReserved != 0 "
+ " AND o.DocStatus NOT IN ( 'VO', 'RE' ) " + " AND o.DocStatus NOT IN ( 'VO', 'RE' ) "
+ " AND o.AD_Client_ID = ? " + " AND o.AD_Client_ID = ? "
+ "GROUP BY ol.M_Warehouse_ID, " + "GROUP BY ol.M_Warehouse_ID, "
+ " ol.M_Product_ID, " + " ol.M_Product_ID, "
+ " COALESCE(M_AttributeSetInstance_ID, 0), " + " COALESCE(ol.M_AttributeSetInstance_ID, 0), "
+ " o.IsSOTrx, " + " o.IsSOTrx, "
+ " w.AD_Client_ID, " + " w.AD_Client_ID, "
+ " w.AD_Org_ID"; + " w.AD_Org_ID";