|View Issue Details|
|Type||Category||Severity||Reproducibility||Date Submitted||Last Update|
|backport||[Openbravo ERP] 04. Warehouse management||major||always||2017-08-21 11:33||2017-08-30 10:12|
|Priority||urgent||Resolution||fixed||Fixed in Version||3.0PR17Q3|
|Status||closed||Fix in branch||Fixed in SCM revision||87bb93f75b52|
|OS Version||Database version||Ant version|
|Product Version||SCM revision|
|Review Assigned To||aferraz|
|Regression level||Packaging and release|
|Regression introduced in release||main|
|Regression introduced by commit||https://code.openbravo.com/erp/devel/pi/rev/0bfbdaa123e3 [^]|
|Triggers an Emergency Pack||No|
0036692: [Costing Migration Process]: Transactions related with closing inventory lines do not have an entry in Transaction Cost tab
|Description||[Costing Migration Process]: Transactions related with closing inventory lines do not have an entry in Transaction Cost tab (M_TRANSACTION_COST)|
The call to insertTrxCosts() function after cost is assigned to closing inventory lines' transactions is getting 0 in countTrx, obtained by calling
It seems it is using different connection and the transactions are not available yet
|Steps To Reproduce||Having a version previous to 3.0MP13 with products with stock, upgrade it to the latest version|
As group admin role (for each client):
Create current period and years (Fiscal Calendar)
Open the current period (Open/Close Period Control)
As system admin role:
Check two entries (Standard and Average) exist in Costing Algorithm window, create them if not
Launch the Costing Migration Process
If it finishes with error, remove the alert of products without cost
Launch the process again
Once it finishes, check the transactions related with closing inventory lines do have Transaction Cost defined in Transactions tab but not a related entry in Transaction Cost tab
|Tags||No tags attached.|
Author: Mark <markmm82 <at> gmail.com>
Date: Wed Aug 23 14:16:09 2017 -0400
URL: http://code.openbravo.com/erp/backports/3.0PR17Q3/rev/87bb93f75b522109909d9e12331638ee84be20f6 [^]
Fixes issue 36692: Transaction Cost not created for closing inventory lines
After cost was assigned to closing inventory lines transactions,
when calling to insertTrxCosts() from calculateCosts() method (second call),
CostingUtilsData.countTrxCosts(conn) was getting 0 in countTrx.
It was caused because closing inventory lines cost calculation
was done by OBDal connection, and methods invoked in CostingUtilsData are done
using different connection provided by SQLC, and the transactions are not available
at this moment. See: http://wiki.openbravo.com/wiki/Data_Access_Layer#Transaction_and_Session [^]
To find the best solution for this issue and don't affect the performance (see issue 35959),
different solutions were tested to always use DAL and make process use the same connection.
1.- Doing a single insert-select query with limits is not supported in DAL. We tried it in two different ways (see attached TestCosting_v1.diff):
- Use setMaxResults(). It only works for selects but not for inserts/updates.
- Use setMaxResults() in select query and append it to insert query using getQueryString(). It appends the select without any limit.
2.- Another option could be to refactor insertTrxCosts() method to do a multiple insert query:
We can create the select query with limits using setMaxResults(), iterate it using an scroll
and create and save in each iteration a new TransactionCost. Flush won't be done in every iteration.
When flush is done, it raises every insert in multiple single-row inserts instead of only one multiple-row insert.
Single-row inserts performs worst than multiple-row insert, at least with not many rows (see attached TestCosting_v2.diff).
3.- Finally, we have refactor the process to avoid insertTrxCosts() method:
Our solution makes an insertion in M_Transaction_Cost table each
time we make the updation of related transaction cost in M_Transaction table.
We will do single-row inserts in two methods: updateTrxLegacyCosts() and calculateCosts(),
and multiple-row insert in one method: updateWithZeroCostRemainingTrx().
Thus, we split the number of TransactionCost records to be created in three different steps.
|Code review + Testing OK|
|2017-08-22 13:20||aferraz||Type||defect => backport|
|2017-08-22 13:20||aferraz||Target Version||=> 3.0PR17Q3|
|2017-08-30 10:10||hgbot||Note Added: 0098718|
|2017-08-30 10:10||hgbot||Status||scheduled => resolved|
|2017-08-30 10:10||hgbot||Resolution||open => fixed|
|2017-08-30 10:10||hgbot||Fixed in SCM revision||=> http://code.openbravo.com/erp/backports/3.0PR17Q3/rev/87bb93f75b522109909d9e12331638ee84be20f6 [^]|
|2017-08-30 10:12||aferraz||Review Assigned To||=> aferraz|
|2017-08-30 10:12||aferraz||Note Added: 0098719|
|2017-08-30 10:12||aferraz||Status||resolved => closed|
|2017-08-30 10:12||aferraz||Fixed in Version||=> 3.0PR17Q3|
|Copyright © 2000 - 2009 MantisBT Group|