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);
// Reverse Line Qty
MInvoiceLine[] rLines = reversal.getLines(false);
MInvoiceLine[] rLines = reversal.getLines(true);
for (int i = 0; i < rLines.length; i++)
{
MInvoiceLine rLine = rLines[i];

View File

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