# HG changeset patch
# User Unai Martirena <unai.martirena@openbravo.com>
# Date 1427703336 -7200
#      Mon Mar 30 10:15:36 2015 +0200
# Node ID 11325551d9922163957ffc59d9124a8c2d1800e5
# Parent  eae800d1dd144db604abe81c7518f4c14d0423b1
Fixes bug 29454: 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.

diff --git a/src/org/openbravo/costing/CostingBackground.java b/src/org/openbravo/costing/CostingBackground.java
--- a/src/org/openbravo/costing/CostingBackground.java
+++ b/src/org/openbravo/costing/CostingBackground.java
@@ -300,6 +300,7 @@
       transactionCostDateacctInitializedPreference.setPropertyList(false);
       OBDal.getInstance().save(transactionCostDateacctInitializedPreference);
       OBDal.getInstance().flush();
+      OBDal.getInstance().getConnection(true).commit();
     }
   }
 }
