Backed out changeset 58849d9510ba
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 05 Dec 2018 17:46:39 +0100
changeset 35211 c40f567a73a9
parent 35210 58849d9510ba
child 35212 616f94939565
Backed out changeset 58849d9510ba
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java	Wed Dec 05 17:23:37 2018 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java	Wed Dec 05 17:46:39 2018 +0100
@@ -169,9 +169,12 @@
             && getConversionRateDocument(transaction).size() == 0) {
           insertConversionRateDocument(transaction);
         }
-        FIN_FinancialAccount financialAccount = transaction.getAccount();
-        OBDal.getInstance().lockForNoKeyUpdate(transaction.getAccount().getEntity(),
-            financialAccount.getId());
+
+        String financialAccountId = OBDal.getInstance().lockForNoKeyUpdate(
+            transaction.getAccount().getEntity(), transaction.getAccount().getId());
+        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+            financialAccountId);
+
         financialAccount.setCurrentBalance(financialAccount.getCurrentBalance().add(
             transaction.getDepositAmount().subtract(transaction.getPaymentAmount())));
         transaction.setAprmProcessed("R");
@@ -241,9 +244,11 @@
           transaction.setStatus(transaction.getDepositAmount().compareTo(
               transaction.getPaymentAmount()) > 0 ? "RPR" : "PPM");
         }
-        FIN_FinancialAccount financialAccount = transaction.getAccount();
-        OBDal.getInstance().lockForNoKeyUpdate(transaction.getAccount().getEntity(),
-            financialAccount.getId());
+        String financialAccountId = OBDal.getInstance().lockForNoKeyUpdate(
+            transaction.getAccount().getEntity(), transaction.getAccount().getId());
+        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+            financialAccountId);
+
         financialAccount.setCurrentBalance(financialAccount.getCurrentBalance()
             .subtract(transaction.getDepositAmount()).add(transaction.getPaymentAmount()));
         transaction.setAprmProcessed("P");