Fixes Issue 32268: Wrong payment status when unmatching bankstatement line
authorAtul Gaware <atul.gaware@openbravo.com>
Mon, 22 Feb 2016 15:33:27 +0530
changeset 28629 143d5c808926
parent 28628 863208bb4993
child 28630 0f887315d105
Fixes Issue 32268: Wrong payment status when unmatching bankstatement line
manually matched against an invoice

Incase a finTransaction is unmatched which has finPayment,status of finPayment
is also updated accordingly as per isReceipt flag
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRM_MatchingUtility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRM_MatchingUtility.java	Mon Feb 22 10:43:16 2016 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRM_MatchingUtility.java	Mon Feb 22 15:33:27 2016 +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) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -319,12 +319,14 @@
         boolean isReceipt = false;
         if (finTrans.getFinPayment() != null) {
           isReceipt = finTrans.getFinPayment().isReceipt();
+          finTrans.getFinPayment().setStatus(
+              isReceipt ? APRMConstants.PAYMENT_STATUS_DEPOSIT_NOT_CLEARED
+                  : APRMConstants.PAYMENT_STATUS_WITHDRAWAL_NOT_CLEARED);
         } else {
           isReceipt = finTrans.getDepositAmount().compareTo(finTrans.getPaymentAmount()) > 0;
         }
         finTrans.setStatus(isReceipt ? APRMConstants.PAYMENT_STATUS_DEPOSIT_NOT_CLEARED
             : APRMConstants.PAYMENT_STATUS_WITHDRAWAL_NOT_CLEARED);
-
         // Execute un-matching logic defined by algorithm
         final MatchingAlgorithm ma = bsline.getBankStatement().getAccount().getMatchingAlgorithm();
         final FIN_MatchingTransaction matchingTransaction = new FIN_MatchingTransaction(