IDEMPIERE-1269 Improve tax configuration to support external services

This commit is contained in:
Elaine Tan 2013-09-03 12:38:13 +08:00
parent 975f7bb03c
commit c250df9d25
4 changed files with 54 additions and 16 deletions

View File

@ -0,0 +1,20 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 3, 2013 12:18:09 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=80,Updated=TO_DATE('2013-09-03 12:18:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202389
;
-- Sep 3, 2013 12:18:10 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=90,Updated=TO_DATE('2013-09-03 12:18:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202390
;
-- Sep 3, 2013 12:18:53 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=240,Updated=TO_DATE('2013-09-03 12:18:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202402
;
SELECT register_migration_script('201309031235_IDEMPIERE-1269.sql') FROM dual
;

View File

@ -0,0 +1,17 @@
-- Sep 3, 2013 12:18:09 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=80,Updated=TO_TIMESTAMP('2013-09-03 12:18:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202389
;
-- Sep 3, 2013 12:18:10 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=90,Updated=TO_TIMESTAMP('2013-09-03 12:18:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202390
;
-- Sep 3, 2013 12:18:53 PM SGT
-- IDEMPIERE-1269 Improve tax configuration to support external services
UPDATE AD_Field SET SeqNoGrid=240,Updated=TO_TIMESTAMP('2013-09-03 12:18:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202402
;
SELECT register_migration_script('201309031235_IDEMPIERE-1269.sql') FROM dual
;

View File

@ -2397,7 +2397,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal.setReversal(true); reversal.setReversal(true);
// Reverse Line Qty // Reverse Line Qty
MInvoiceLine[] rLines = reversal.getLines(false); MInvoiceLine[] rLines = reversal.getLines(true);
for (int i = 0; i < rLines.length; i++) for (int i = 0; i < rLines.length; i++)
{ {
MInvoiceLine rLine = rLines[i]; MInvoiceLine rLine = rLines[i];

View File

@ -41,11 +41,10 @@ public class StandardTaxProvider implements ITaxProvider {
Integer taxID = new Integer(line.getC_Tax_ID()); Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID)) if (!taxList.contains(taxID))
{ {
MOrderTax oTax = MOrderTax.get (line, order.getPrecision(), MTax tax = new MTax(order.getCtx(), taxID, order.get_TrxName());
false, order.get_TrxName()); // current Tax if (tax.getC_TaxProvider_ID() != 0)
if (oTax.getC_TaxProvider_ID() != 0) {
continue; continue;
} MOrderTax oTax = MOrderTax.get (line, order.getPrecision(), false, order.get_TrxName()); // current Tax
oTax.setIsTaxIncluded(order.isTaxIncluded()); oTax.setIsTaxIncluded(order.isTaxIncluded());
if (!oTax.calculateTaxFromLines()) if (!oTax.calculateTaxFromLines())
return false; return false;
@ -126,13 +125,12 @@ public class StandardTaxProvider implements ITaxProvider {
totalLines = totalLines.add(line.getLineNetAmt()); totalLines = totalLines.add(line.getLineNetAmt());
if (!taxList.contains(line.getC_Tax_ID())) if (!taxList.contains(line.getC_Tax_ID()))
{ {
MTax tax = new MTax(invoice.getCtx(), line.getC_Tax_ID(), invoice.get_TrxName());
if (tax.getC_TaxProvider_ID() != 0)
continue;
MInvoiceTax iTax = MInvoiceTax.get (line, invoice.getPrecision(), false, invoice.get_TrxName()); // current Tax MInvoiceTax iTax = MInvoiceTax.get (line, invoice.getPrecision(), false, invoice.get_TrxName()); // current Tax
if (iTax != null) if (iTax != null)
{ {
if (iTax.getC_TaxProvider_ID() != 0) {
continue;
}
iTax.setIsTaxIncluded(invoice.isTaxIncluded()); iTax.setIsTaxIncluded(invoice.isTaxIncluded());
if (!iTax.calculateTaxFromLines()) if (!iTax.calculateTaxFromLines())
return false; return false;
@ -202,9 +200,13 @@ public class StandardTaxProvider implements ITaxProvider {
public boolean recalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord) { public boolean recalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord) {
if (!newRecord && line.is_ValueChanged(MInvoiceLine.COLUMNNAME_C_Tax_ID)) if (!newRecord && line.is_ValueChanged(MInvoiceLine.COLUMNNAME_C_Tax_ID))
{ {
// Recalculate Tax for old Tax MTax mtax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
if (!line.updateInvoiceTax(true)) if (mtax.getC_TaxProvider_ID() == 0)
return false; {
// Recalculate Tax for old Tax
if (!line.updateInvoiceTax(true))
return false;
}
} }
return line.updateHeaderTax(); return line.updateHeaderTax();
} }
@ -222,11 +224,10 @@ public class StandardTaxProvider implements ITaxProvider {
Integer taxID = new Integer(line.getC_Tax_ID()); Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID)) if (!taxList.contains(taxID))
{ {
MRMATax oTax = MRMATax.get (line, rma.getPrecision(), MTax tax = new MTax(rma.getCtx(), taxID, rma.get_TrxName());
false, rma.get_TrxName()); // current Tax if (tax.getC_TaxProvider_ID() != 0)
if (oTax.getC_TaxProvider_ID() != 0) {
continue; continue;
} MRMATax oTax = MRMATax.get (line, rma.getPrecision(), false, rma.get_TrxName()); // current Tax
oTax.setIsTaxIncluded(rma.isTaxIncluded()); oTax.setIsTaxIncluded(rma.isTaxIncluded());
if (!oTax.calculateTaxFromLines()) if (!oTax.calculateTaxFromLines())
return false; return false;