From dd1dc6ed9228fab67c0ba8e408bb7cdbfd5843f8 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Tue, 9 Feb 2010 22:26:35 +0000 Subject: [PATCH] BF [2948632] - Unable to edit the default tax rate. https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2948632&group_id=176962 --- base/src/org/compiere/model/MTax.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/base/src/org/compiere/model/MTax.java b/base/src/org/compiere/model/MTax.java index ab949e8d42..2510f2bab8 100644 --- a/base/src/org/compiere/model/MTax.java +++ b/base/src/org/compiere/model/MTax.java @@ -31,7 +31,9 @@ import org.compiere.util.TimeUtil; * * @author Jorg Janke * @version $Id: MTax.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $ - * red1 - FR: [ 2214883 ] Remove SQL code and Replace for Query + * red1 - FR: [ 2214883 ] Remove SQL code and Replace for Query + * trifonnt - BF [2913276] - Allow only one Default Tax Rate per Tax Category + * mjmckay - BF [2948632] - Allow edits to the Defautl Tax Rate */ public class MTax extends X_C_Tax { @@ -280,9 +282,12 @@ public class MTax extends X_C_Tax protected boolean beforeSave(boolean newRecord) { if (isDefault()) { // @Trifon - Ensure that only one tax rate is set as Default! - String whereClause = MTax.COLUMNNAME_C_TaxCategory_ID+"=? AND IsDefault='Y'"; + // @Mckay - Allow edits to the Default tax rate + String whereClause = MTax.COLUMNNAME_C_TaxCategory_ID+"=? AND " + + MTax.COLUMNNAME_C_Tax_ID+"<>? AND "+ + "IsDefault='Y'"; List list = new Query(getCtx(), MTax.Table_Name, whereClause, get_TrxName()) - .setParameters(new Object[]{getC_TaxCategory_ID()}) + .setParameters(new Object[]{getC_TaxCategory_ID(), getC_Tax_ID()}) .setOnlyActiveRecords(true) .list(); if (list.size() >= 1) {