Fixes issue 25979: Impossible to post a reconciliation
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Mon, 07 Apr 2014 14:03:23 +0200
changeset 22880 d80df926f9ba
parent 22879 97d8cf3e7d76
child 22881 f0e068c5bbca
Fixes issue 25979: Impossible to post a reconciliation
src/org/openbravo/erpCommon/utility/CashVATUtil.java
--- a/src/org/openbravo/erpCommon/utility/CashVATUtil.java	Mon Apr 07 15:11:15 2014 +0530
+++ b/src/org/openbravo/erpCommon/utility/CashVATUtil.java	Mon Apr 07 14:03:23 2014 +0200
@@ -376,12 +376,16 @@
                   cCurrencyID, taxAmt.toString(), "", Fact_Acct_Group_ID,
                   nextSeqNo(factLine1.m_SeqNo), documentType, conn);
             } else {
-              final FactLine factLine1 = fact.createLine(line,
-                  m_tax.getAccount(DocTax.ACCTTYPE_TaxDue_Trans, as, conn), cCurrencyID,
-                  taxAmt.toString(), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), documentType, conn);
-              factLine2 = fact.createLine(line, m_tax.getAccount(DocTax.ACCTTYPE_TaxDue, as, conn),
-                  cCurrencyID, "", taxAmt.toString(), Fact_Acct_Group_ID,
-                  nextSeqNo(factLine1.m_SeqNo), documentType, conn);
+              if (taxAmt.compareTo(BigDecimal.ZERO) != 0) {
+                final FactLine factLine1 = fact
+                    .createLine(line, m_tax.getAccount(DocTax.ACCTTYPE_TaxDue_Trans, as, conn),
+                        cCurrencyID, taxAmt.toString(), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+                        documentType, conn);
+                factLine2 = fact.createLine(line,
+                    m_tax.getAccount(DocTax.ACCTTYPE_TaxDue, as, conn), cCurrencyID, "",
+                    taxAmt.toString(), Fact_Acct_Group_ID, nextSeqNo(factLine1.m_SeqNo),
+                    documentType, conn);
+              }
             }
           }// ARC
           else if (invoicedocumentType.equals(AcctServer.DOCTYPE_ARCredit)) {