Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038206Openbravo ERPI. Performancepublic2018-03-22 18:292018-05-09 19:29
gorkaion 
collazoandy4 
urgentmajoralways
closedfixed 
5
 
3.0PR18Q3 
dmiguelez
Core
No
0038206: Cost Adjustment Process generates too much lines
A Cost Adjustment on an environment with 16k transactions and adjusting 11.5k transactions generates 237k lines when attributes and manufacturing are involved.

When adjusting a product used as Raw Material in a Production the same m_transaction can be added several times in different cost adjustment lines.

For example, consider a manufacturing that generates 2 different products of different lots. and consumes different lots of the same raw material.

We have these transactions-

Trx 1 P- Raw Material A Lot1 -5
Trx 2 P- Raw Material A Lot2 -5
Trx 3 P- Raw Material A Lot3 -2

Trx 4 P+ Produced A Lot1 +2
Trx 5 P+ Produced A Lot2 +2
Trx 6 P+ Produced B Lot1 +1
Trx 7 P+ Produced B Lot1 +1

When adjusting the trx1 the searchManufacturingProduced() addes a cost adjustment line for trx 4 to 7.
Next trx2 is adjusted and again it addes new lines for trx4 to 7.
Next trx3 is adjusted and again it addes new lines for trx4 to 7.

Resulting in 12 cost adjustment lines for 4 transactions. In a customer instance there is and adjustment where a single transaction has been adjusted in more than 200 lines.
On an environment with around 16k transactions using manufacturing.
Execute a Cost Adjustment on one of the oldest transactions of a raw material.
This adjustment will also impact all items produced with that raw material resulting in a cost adjustment including many m_transactions, and much more adjustment lines.
Change how related lines are added to reduce the number of cost adjustment lines.It has no sense to have an average of 20 cost adjustment lines on a cost adjustment (237k lines of just 11.5k trx)
No tags attached.
related to defect 0038205 closed collazoandy4 Cost Adjustment Process very slow 
Issue History
2018-03-22 18:29gorkaionNew Issue
2018-03-22 18:29gorkaionAssigned To => Triage Finance
2018-03-22 18:29gorkaionModules => Core
2018-03-22 18:29gorkaionResolution time => 1523484000
2018-03-22 18:29gorkaionTriggers an Emergency Pack => No
2018-03-22 18:29gorkaionIssue generated from0038205
2018-03-22 18:31gorkaionRelationship addedrelated to 0038205
2018-03-23 10:16ngarciaIssue Monitored: ngarcia
2018-04-09 19:35aferrazAssigned ToTriage Finance => collazoandy4
2018-04-12 17:22collazoandy4Statusnew => scheduled
2018-04-17 08:48dmiguelezStatusscheduled => feedback
2018-04-20 13:09gorkaionStatusfeedback => scheduled
2018-05-02 18:16collazoandy4Note Added: 0104213
2018-05-04 09:27hgbotCheckin
2018-05-04 09:27hgbotNote Added: 0104273
2018-05-04 09:27hgbotStatusscheduled => resolved
2018-05-04 09:27hgbotResolutionopen => fixed
2018-05-04 09:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4a8d9e451d4dc7635a15dd4f399ef00053f475d1 [^]
2018-05-04 09:29dmiguelezReview Assigned To => dmiguelez
2018-05-04 09:29dmiguelezNote Added: 0104277
2018-05-04 09:29dmiguelezStatusresolved => closed
2018-05-04 09:29dmiguelezFixed in Version => 3.0PR18Q3
2018-05-09 19:29hudsonbotCheckin
2018-05-09 19:29hudsonbotNote Added: 0104430

Notes
(0104213)
collazoandy4   
2018-05-02 18:16   
On an environment with 13 559 transactions made and adjustment of one transaction for a BOM product, the adjustment process create a cost adjustment with 264 760 lines.
  With the fix for this issue applied on this environment the adjustment process create a cost adjustment with only 53 751 lines
(0104273)
hgbot   
2018-05-04 09:27   
Repository: erp/devel/pi
Changeset: 4a8d9e451d4dc7635a15dd4f399ef00053f475d1
Author: Armaignac <collazoandy4 <at> gmail.com>
Date: Wed Apr 25 21:37:01 2018 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/4a8d9e451d4dc7635a15dd4f399ef00053f475d1 [^]

Fixes issue 38206: Cost Adjustment Process generates too much lines

When adjusting a product used as Raw Material in a Production the same
m_transaction can be added several times in different cost adjustment lines.

Now when exists a non processed cost adjustment line for the same transaccion,
currency, accounting date and source the adjusted amount is added instance of
create a new adjustment line.

---
M src-test/src/org/openbravo/test/costing/TestCostingNoSourceAdjustments.java
M src-test/src/org/openbravo/test/costing/assertclass/CostAdjustmentAssert.java
M src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
---
(0104277)
dmiguelez   
2018-05-04 09:29   
Code Review + Testing Ok
(0104430)
hudsonbot   
2018-05-09 19:29   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/2be7d3efe606 [^]
Maturity status: Test