Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0036692
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] 04. Warehouse managementmajoralways2017-08-21 11:332017-08-30 10:12
ReporterngarciaView Statuspublic 
Assigned Tomarkmm82 
PriorityurgentResolutionfixedFixed in Version3.0PR17Q3
StatusclosedFix in branchFixed in SCM revision87bb93f75b52
ProjectionnoneETAnoneTarget Version3.0PR17Q3
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression levelPackaging and release
Regression date2017-05-25
Regression introduced in releasemain
Regression introduced by commithttps://code.openbravo.com/erp/devel/pi/rev/0bfbdaa123e3 [^]
Triggers an Emergency PackNo
Summary

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

CostingUtilsData.countTrxCosts(conn)

It seems it is using different connection and the transactions are not available yet
Steps To ReproduceHaving 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
   
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0036675 closedmarkmm82 [Costing Migration Process]: Transactions related with closing inventory lines do not have an entry in Transaction Cost tab 

-  Notes
(0098718)
hgbot (developer)
2017-08-30 10:10

Repository: erp/backports/3.0PR17Q3
Changeset: 87bb93f75b522109909d9e12331638ee84be20f6
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.

---
M src/org/openbravo/costing/CostingMigrationProcess.java
M src/org/openbravo/costing/CostingUtils_data.xsql
---
(0098719)
aferraz (manager)
2017-08-30 10:12

Code review + Testing OK

- Issue History
Date Modified Username Field Change
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 Checkin
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
Powered by Mantis Bugtracker