related to issue 39672 lockForNoKeyUpdate not returns the id
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 05 Dec 2018 17:23:37 +0100
changeset 35210 58849d9510ba
parent 35209 1c1d34a46d47
child 35211 c40f567a73a9
related to issue 39672 lockForNoKeyUpdate not returns the id
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:17:46 2018 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java	Wed Dec 05 17:23:37 2018 +0100
@@ -169,12 +169,9 @@
             && getConversionRateDocument(transaction).size() == 0) {
           insertConversionRateDocument(transaction);
         }
-
-        String financialAccountId = OBDal.getInstance().lockForNoKeyUpdate(
-            transaction.getAccount().getEntity(), transaction.getAccount().getId());
-        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
-            financialAccountId);
-
+        FIN_FinancialAccount financialAccount = transaction.getAccount();
+        OBDal.getInstance().lockForNoKeyUpdate(transaction.getAccount().getEntity(),
+            financialAccount.getId());
         financialAccount.setCurrentBalance(financialAccount.getCurrentBalance().add(
             transaction.getDepositAmount().subtract(transaction.getPaymentAmount())));
         transaction.setAprmProcessed("R");
@@ -244,11 +241,9 @@
           transaction.setStatus(transaction.getDepositAmount().compareTo(
               transaction.getPaymentAmount()) > 0 ? "RPR" : "PPM");
         }
-        String financialAccountId = OBDal.getInstance().lockForNoKeyUpdate(
-            transaction.getAccount().getEntity(), transaction.getAccount().getId());
-        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
-            financialAccountId);
-
+        FIN_FinancialAccount financialAccount = transaction.getAccount();
+        OBDal.getInstance().lockForNoKeyUpdate(transaction.getAccount().getEntity(),
+            financialAccount.getId());
         financialAccount.setCurrentBalance(financialAccount.getCurrentBalance()
             .subtract(transaction.getDepositAmount()).add(transaction.getPaymentAmount()));
         transaction.setAprmProcessed("P");