From fe2087a15abeacd3ece9fc94455d667606572086 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 14 Jan 2008 03:24:40 +0000 Subject: [PATCH] [ 1621142 ] "Create From" dialog shows irrelevant purchase orders - merge submitted patch. --- client/src/org/compiere/grid/VCreateFrom.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client/src/org/compiere/grid/VCreateFrom.java b/client/src/org/compiere/grid/VCreateFrom.java index bbf1b96b54..25d4643c84 100644 --- a/client/src/org/compiere/grid/VCreateFrom.java +++ b/client/src/org/compiere/grid/VCreateFrom.java @@ -382,18 +382,15 @@ public abstract class VCreateFrom extends CDialog .append("||' - '||") .append(DB.TO_CHAR("o.GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx()))); // - String column = "m.M_InOutLine_ID"; + String column = "ol.QtyDelivered"; if (forInvoice) - column = "m.C_InvoiceLine_ID"; + column = "ol.QtyInvoiced"; StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,").append(display) .append(" FROM C_Order o " + "WHERE o.C_BPartner_ID=? AND o.IsSOTrx='N' AND o.DocStatus IN ('CL','CO')" + " AND o.C_Order_ID IN " + "(SELECT ol.C_Order_ID FROM C_OrderLine ol" - + " LEFT OUTER JOIN M_MatchPO m ON (ol.C_OrderLine_ID=m.C_OrderLine_ID) " - + "GROUP BY ol.C_Order_ID,ol.C_OrderLine_ID, ol.QtyOrdered,").append(column) - .append(" HAVING (ol.QtyOrdered <> SUM(m.Qty) AND ").append(column) - .append(" IS NOT NULL) OR ").append(column).append(" IS NULL) " + + " WHERE ol.QtyOrdered - ").append(column).append(" != 0) " + "ORDER BY o.DateOrdered"); try {