Fixes BUG-0043916: Unbalanced accounting in case a Payment Settled in a
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 13 May 2020 11:17:16 +0530
changeset 37350 0a9617665103
parent 37349 e4c009b8d9c3
child 37351 1c51e3e83830
Fixes BUG 0043916: Unbalanced accounting in case a Payment Settled in a
remittance is unposted, as it can not be posted again any more

**Used FIN_Utility.isPaymentConfirmed which also considers payment
status implemented by other modules long with Core module. In this
case REM_CANCEL payment status is considered for posting a payment
This status is set when RemittanceType has isRemitForDiscount flag
= Yes during settling the Remittance.
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed May 13 17:47:28 2020 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed May 13 11:17:16 2020 +0530
@@ -788,19 +788,11 @@
   public boolean getDocumentConfirmation(ConnectionProvider conn, String strRecordId) {
     // Checks if this step is configured to generate accounting for the selected financial account
     boolean confirmation = false;
-    final String PAYMENT_RECEIVED = "RPR";
-    final String PAYMENT_MADE = "PPM";
-    final String DEPOSITED_NOT_CLEARED = "RDNC";
-    final String WITHDRAWN_NOT_CLEARED = "PWNC";
-    final String PAYMENT_CLEARED = "RPPC";
     OBContext.setAdminMode();
     try {
       FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, strRecordId);
       // Posting can just happen if payment is in the right status
-      if (payment.getStatus().equals(PAYMENT_RECEIVED) || payment.getStatus().equals(PAYMENT_MADE)
-          || payment.getStatus().equals(DEPOSITED_NOT_CLEARED)
-          || payment.getStatus().equals(WITHDRAWN_NOT_CLEARED)
-          || payment.getStatus().equals(PAYMENT_CLEARED)) {
+      if (FIN_Utility.isPaymentConfirmed(payment.getStatus(), null)) {
         OBCriteria<FinAccPaymentMethod> obCriteria = OBDal.getInstance()
             .createCriteria(FinAccPaymentMethod.class);
         obCriteria.add(Restrictions.eq(FinAccPaymentMethod.PROPERTY_ACCOUNT, payment.getAccount()));