diff --git a/migration/i1.0c-release/oracle/201309031235_IDEMPIERE-1269.sql b/migration/i1.0c-release/oracle/201309031235_IDEMPIERE-1269.sql new file mode 100644 index 0000000000..174c5edc82 --- /dev/null +++ b/migration/i1.0c-release/oracle/201309031235_IDEMPIERE-1269.sql @@ -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 +; \ No newline at end of file diff --git a/migration/i1.0c-release/postgresql/201309031235_IDEMPIERE-1269.sql b/migration/i1.0c-release/postgresql/201309031235_IDEMPIERE-1269.sql new file mode 100644 index 0000000000..6b0d14c792 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309031235_IDEMPIERE-1269.sql @@ -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 +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 972d4ff40b..f11b1703e2 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -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]; diff --git a/org.adempiere.base/src/org/compiere/model/StandardTaxProvider.java b/org.adempiere.base/src/org/compiere/model/StandardTaxProvider.java index 2ebed3bb7f..262b09a41a 100644 --- a/org.adempiere.base/src/org/compiere/model/StandardTaxProvider.java +++ b/org.adempiere.base/src/org/compiere/model/StandardTaxProvider.java @@ -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; @@ -202,9 +200,13 @@ public class StandardTaxProvider implements ITaxProvider { public boolean recalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord) { if (!newRecord && line.is_ValueChanged(MInvoiceLine.COLUMNNAME_C_Tax_ID)) { - // Recalculate Tax for old Tax - if (!line.updateInvoiceTax(true)) - return false; + 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;