BF [1733602] - Price List including Tax Error

http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332
Handle the case when no Default Tax Rate is specified.
This commit is contained in:
trifonnt 2009-12-04 20:14:41 +00:00
parent bc25c66b3e
commit 29c552c9ea
1 changed files with 5 additions and 6 deletions

View File

@ -75,15 +75,14 @@ public class MTaxCategory extends X_C_TaxCategory
List<MTax> list = new Query(getCtx(), MTax.Table_Name, whereClause, get_TrxName())
.setParameters(new Object[]{getC_TaxCategory_ID()})
.list();
if (list.size() == 1)
if (list.size() == 0) {
throw new AdempiereException("NoDefaultTaxRate"); // Error - should be at least one default
} else if (list.size() == 1) {
m_tax = list.get(0);
else {
// Error - should only be one default
throw new AdempiereException("TooManyDefaults");
} else {
throw new AdempiereException("TooManyDefaults"); // Error - should only be one default
}
return m_tax;
} // getDefaultTax