IDEMPIERE-3054 Issue with summary tax

This commit is contained in:
Carlos Ruiz 2016-03-16 23:15:45 +01:00
parent 2146e032b3
commit 297e78f30c
2 changed files with 16 additions and 9 deletions

View File

@ -1019,12 +1019,19 @@ public class MOrderLine extends X_C_OrderLine
{ {
if (!success) if (!success)
return success; return success;
MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName()); if (getParent().isProcessed())
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName()); return success;
ITaxProvider calculator = Core.getTaxProvider(provider); if ( newRecord
if (calculator == null) || is_ValueChanged(MOrderLine.COLUMNNAME_C_Tax_ID)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider")); || is_ValueChanged(MOrderLine.COLUMNNAME_LineNetAmt)) {
return calculator.recalculateTax(provider, this, newRecord); MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName());
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
return calculator.recalculateTax(provider, this, newRecord);
}
return success;
} // afterSave } // afterSave
/** /**

View File

@ -79,7 +79,7 @@ public class StandardTaxProvider implements ITaxProvider {
for (int j = 0; j < cTaxes.length; j++) for (int j = 0; j < cTaxes.length; j++)
{ {
MTax cTax = cTaxes[j]; MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), order.isTaxIncluded(), order.getPrecision()); BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), false, order.getPrecision());
// //
MOrderTax newOTax = new MOrderTax(order.getCtx(), 0, order.get_TrxName()); MOrderTax newOTax = new MOrderTax(order.getCtx(), 0, order.get_TrxName());
newOTax.setClientOrg(order); newOTax.setClientOrg(order);
@ -210,7 +210,7 @@ public class StandardTaxProvider implements ITaxProvider {
for (int j = 0; j < cTaxes.length; j++) for (int j = 0; j < cTaxes.length; j++)
{ {
MTax cTax = cTaxes[j]; MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(iTax.getTaxBaseAmt(), invoice.isTaxIncluded(), invoice.getPrecision()); BigDecimal taxAmt = cTax.calculateTax(iTax.getTaxBaseAmt(), false, invoice.getPrecision());
// //
MInvoiceTax newITax = new MInvoiceTax(invoice.getCtx(), 0, invoice.get_TrxName()); MInvoiceTax newITax = new MInvoiceTax(invoice.getCtx(), 0, invoice.get_TrxName());
newITax.setClientOrg(invoice); newITax.setClientOrg(invoice);
@ -336,7 +336,7 @@ public class StandardTaxProvider implements ITaxProvider {
for (int j = 0; j < cTaxes.length; j++) for (int j = 0; j < cTaxes.length; j++)
{ {
MTax cTax = cTaxes[j]; MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), rma.isTaxIncluded(), rma.getPrecision()); BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), false, rma.getPrecision());
// //
MRMATax newOTax = new MRMATax(rma.getCtx(), 0, rma.get_TrxName()); MRMATax newOTax = new MRMATax(rma.getCtx(), 0, rma.get_TrxName());
newOTax.setClientOrg(rma); newOTax.setClientOrg(rma);