Fixes bug 29440: Initialize dateacct column is always been done.
authorUnai Martirena <unai.martirena@openbravo.com>
Mon, 30 Mar 2015 10:10:41 +0200
changeset 26297 1377ec164924
parent 26296 09425e334a72
child 26298 34da08f135b8
Fixes bug 29440: Initialize dateacct column is always been done.

At the beginning of costing background a process to initialize dateacct column of m_transaction_cost has being added. This process is independant from Costing Background, but it was added here to avoid the performance problems that it was causing when executing as a modulescript.

It this columns are not initialized it will not be possible to launch 'Sales Invoice Dimensional Report' and 'Valued Stock Report'. The problem happens when the Costing Background process fails for the first transaction that is calculating, because it rollbacks everything, including the process to initialize dateacct column, so, it is not possible to launch the two reports.

A OBDal.getInstance().getConnection(true).commit() has been added right after initializing dateacct to maintain this changes even when the Costing background fails on the first transaction.
src/org/openbravo/costing/CostingBackground.java
--- a/src/org/openbravo/costing/CostingBackground.java	Mon Mar 30 16:30:48 2015 +0200
+++ b/src/org/openbravo/costing/CostingBackground.java	Mon Mar 30 10:10:41 2015 +0200
@@ -300,6 +300,7 @@
       transactionCostDateacctInitializedPreference.setPropertyList(false);
       OBDal.getInstance().save(transactionCostDateacctInitializedPreference);
       OBDal.getInstance().flush();
+      OBDal.getInstance().getConnection(true).commit();
     }
   }
 }