Fixes Issues 27820:Error when posting Payment/Transaction/Reconciliation
authorAtul Gaware <atul.gaware@openbravo.com>
Mon, 24 Nov 2014 20:20:57 +0530
changeset 24101 f0f3d691ee2a
parent 24100 38f1e85d7ae1
child 24102 d5b35789bcf0
Fixes Issues 27820:Error when posting Payment/Transaction/Reconciliation
referencing a cash vat invoice linked to several orders

Issue is a regression due to related fix for issue 26571. Cast Vat lines
were posted as many times the no. of orders linked with cash vat invoices.
So now posting is based on the payment details so the relevant cash vat line
associated with it is posted though it is looped as many times as the no. of
orders linked.
src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java
src/org/openbravo/erpCommon/ad_forms/DocLineCashVATReady_PaymentTransactionReconciliation.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Wed Nov 19 18:09:26 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Mon Nov 24 20:20:57 2014 +0530
@@ -387,7 +387,7 @@
                   .getInvoice()
                   : null);
           docLine.setDoubtFulDebtAmount(new BigDecimal(data[i].getField("DoubtFulDebtAmount")));
-          docLine.setInvoiceTaxCashVAT_V(strPaymentId);
+          docLine.setInvoiceTaxCashVAT_V(paymentDetail_ID);
         }
         docLine.setIsPrepayment(data[i].getField("isprepayment"));
         docLine.setCGlItemId(data[i].getField("cGlItemId"));
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed Nov 19 18:09:26 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Mon Nov 24 20:20:57 2014 +0530
@@ -301,7 +301,7 @@
                 .getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule().getInvoice()
                 : null);
         docLine.m_Record_Id2 = data[i].getField("recordId2");
-        docLine.setInvoiceTaxCashVAT_V(detail.getFinPayment().getId());
+        docLine.setInvoiceTaxCashVAT_V(Line_ID);
         list.add(docLine);
       } finally {
         OBContext.restorePreviousMode();
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Wed Nov 19 18:09:26 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Mon Nov 24 20:20:57 2014 +0530
@@ -697,7 +697,7 @@
         // Cambiar line to reflect BPs
         FIN_PaymentDetail paymentDetail = OBDal.getInstance().get(FIN_PaymentDetail.class,
             finPaymentDetailID);
-        detail.setInvoiceTaxCashVAT_V(paymentDetail.getFinPayment().getId());
+        detail.setInvoiceTaxCashVAT_V(finPaymentDetailID);
         fact = createFactPaymentDetails(detail, paymentDetail, as, conn, fact, Fact_Acct_Group_ID,
             Fact_Acct_Group_ID2);
       }
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineCashVATReady_PaymentTransactionReconciliation.java	Wed Nov 19 18:09:26 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineCashVATReady_PaymentTransactionReconciliation.java	Mon Nov 24 20:20:57 2014 +0530
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -50,19 +50,20 @@
     this.invoiceTaxCashVAT_V = invoiceTaxCashVAT_V;
   }
 
-  public void setInvoiceTaxCashVAT_V(String finPaymentID) {
-    if (StringUtils.isBlank(finPaymentID)) {
+  public void setInvoiceTaxCashVAT_V(String finPaymentDetailID) {
+    if (StringUtils.isBlank(finPaymentDetailID)) {
       this.invoiceTaxCashVAT_V = new ArrayList<InvoiceTaxCashVAT_V>();
     } else {
       try {
         OBContext.setAdminMode(true);
         final StringBuffer hql = new StringBuffer();
         hql.append(" as itcv ");
-        hql.append(" where itcv." + InvoiceTaxCashVAT_V.PROPERTY_PAYMENT + ".id = :finPaymentID ");
+        hql.append(" where itcv." + InvoiceTaxCashVAT_V.PROPERTY_PAYMENTDETAILS
+            + ".id = :finPaymentDetailID ");
         hql.append(" and itcv." + InvoiceTaxCashVAT_V.PROPERTY_CANCELED + " = false");
         OBQuery<InvoiceTaxCashVAT_V> obq = OBDal.getInstance().createQuery(
             InvoiceTaxCashVAT_V.class, hql.toString());
-        obq.setNamedParameter("finPaymentID", finPaymentID);
+        obq.setNamedParameter("finPaymentDetailID", finPaymentDetailID);
         obq.setFilterOnReadableClients(false);
         obq.setFilterOnReadableOrganization(false);