From 210846ddf15d45db91e07b9ed63da8ef0bcc3de4 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Sat, 28 Apr 2007 14:55:02 +0000 Subject: [PATCH] [ 1704554 ] Can't merge products when there are costing records http://sourceforge.net/tracker/?func=detail&atid=879332&aid=1704554&group_id=176962 Allow to merge if there are no costs yet. --- client/src/org/compiere/apps/form/VMerge.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/org/compiere/apps/form/VMerge.java b/client/src/org/compiere/apps/form/VMerge.java index 7c29c8d306..183d88e9da 100644 --- a/client/src/org/compiere/apps/form/VMerge.java +++ b/client/src/org/compiere/apps/form/VMerge.java @@ -69,6 +69,7 @@ public class VMerge extends CPanel static private String[] s_delete_Product = new String[] {"M_Product_PO", "M_Replenish", "T_Replenish", "M_ProductPrice", "M_Product_Costing", + "M_Cost", // teo_sarca [ 1704554 ] "M_Product_Trl", "M_Product_Acct"}; // M_Storage private String[] m_columnName = null; @@ -314,7 +315,7 @@ public class VMerge extends CPanel m_trx = Trx.get(Trx.createTrxName("merge"), true); // - pstmt = DB.prepareStatement(sql, m_trx.createTrxName()); + pstmt = DB.prepareStatement(sql, Trx.createTrxName()); pstmt.setString(1, ColumnName); pstmt.setString(2, ColumnName); ResultSet rs = pstmt.executeQuery(); @@ -406,6 +407,14 @@ public class VMerge extends CPanel sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID; } } + // Delete newly created MCost records - teo_sarca [ 1704554 ] + if (delete && X_M_Cost.Table_Name.equals(TableName) && M_PRODUCT_ID.equals(ColumnName)) + { + sql += " AND " + X_M_Cost.COLUMNNAME_CurrentCostPrice + "=0" + + " AND " + X_M_Cost.COLUMNNAME_CurrentQty + "=0" + + " AND " + X_M_Cost.COLUMNNAME_CumulatedAmt + "=0" + + " AND " + X_M_Cost.COLUMNNAME_CumulatedQty + "=0"; + } int count = DB.executeUpdate(sql, m_trx.getTrxName());