Fixed issue 33354: Cash VAT accounting with several ledgers
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Mon, 27 Jun 2016 11:57:06 +0200
changeset 29708 cc5f703395d6
parent 29707 a3c288cd3d2f
child 29709 865878a5d292
Fixed issue 33354: Cash VAT accounting with several ledgers

Comparing objects was wrongly done using equals instead of comparing by the ID.
The iteration for the first accounting schema worked fine, but the next ones were identified as other objects (although the record ID was the same).
Now the comparation is done using the ID.
src/org/openbravo/erpCommon/utility/CashVATUtil.java
--- a/src/org/openbravo/erpCommon/utility/CashVATUtil.java	Mon Jun 27 18:59:29 2016 +0200
+++ b/src/org/openbravo/erpCommon/utility/CashVATUtil.java	Mon Jun 27 11:57:06 2016 +0200
@@ -495,7 +495,7 @@
         for (final InvoiceTaxCashVAT_V itcv : line.getInvoiceTaxCashVAT_V()) {
           final TaxRate tax = itcv.getInvoiceTax().getTax();
           Invoice inv = itcv.getInvoiceTax().getInvoice();
-          if (tax.isCashVAT() && inv.equals(invoice)) {
+          if (tax.isCashVAT() && StringUtils.equals(inv.getId(), invoice.getId())) {
             final BigDecimal taxAmt = itcv.getTaxAmount();
             if (taxAmt.compareTo(BigDecimal.ZERO) != 0) {
               final DocTax m_tax = new DocTax(tax.getId(), tax.getName(), tax.getRate().toString(),