Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042515Openbravo ERP04. Warehouse managementpublic2019-12-11 12:152020-03-20 17:54
gorkaion 
AtulOpenbravo 
highmajoralways
closedfixed 
5
 
3.0PR20Q2 
dmiguelez
Core
No
0042515: Wrong cost calculated for backdated goods movements
When a backdated goods movement is processed the cost is wrongly calculated.

The M- transaction is correctly adjusted, but the M+ is not. This results that the transactions have different total cost which is wrong.

When the cost of the M+ transaction is calculated it should be 20 instead of 25 as it should consider all the adjustments done to the M- transaction.
1. Login as F&B International
2. Create a New Costing Rules : Organization : F&B US, Inc, Average, Fix BackDate : Y
3. Create New Product : Product A, Organization : F&B US, Inc. , Type : Item, Stocked = Yes
4. Create Physical Inventory :Date : Today, Product A, Qty 100, Cost: USD1 , warehouse : US East Cost
5. Create Physical Inventory : Date : Tomorrow, Product A, Qty : 200, Cost USD1.5 , Warehouse : US East Cost
6. Product A Total Stock : 200, Avg Cost USD1.25
7. Goods Movement : Date : Today, Product A, Qty 20, From Us East Cost To US West Cost (back date transaction)
8. Execute Costing Process
9. Go to Window Product, select Product A, go to tab transaction, there are 4 transaction there,
10. Check the total cost for M+ & M-.
 * M- is 20 (correct)
 * M+ is 25 (wrong)
11. Check average costs:
 * M+ avg is 1.05 -> it should be 1
 * 2nd Inv. Avg is 1.28 -> it should be 1.25
No tags attached.
Issue History
2019-12-11 12:15gorkaionNew Issue
2019-12-11 12:15gorkaionAssigned To => Triage Finance
2019-12-11 12:15gorkaionModules => Core
2019-12-11 12:15gorkaionResolution time => 1577833200
2019-12-11 12:15gorkaionTriggers an Emergency Pack => No
2019-12-12 08:37dmiguelezAssigned ToTriage Finance => AtulOpenbravo
2019-12-20 12:43AtulOpenbravoStatusnew => scheduled
2020-01-08 09:43AtulOpenbravoNote Added: 0116683
2020-01-09 08:12hgbotCheckin
2020-01-09 08:12hgbotNote Added: 0116714
2020-01-09 08:12hgbotStatusscheduled => resolved
2020-01-09 08:12hgbotResolutionopen => fixed
2020-01-09 08:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7443fbd2b22481ddf912d350cf01420359d0d393 [^]
2020-01-09 08:12hgbotCheckin
2020-01-09 08:12hgbotNote Added: 0116715
2020-01-09 08:13dmiguelezReview Assigned To => dmiguelez
2020-01-09 08:13dmiguelezNote Added: 0116716
2020-01-09 08:13dmiguelezStatusresolved => closed
2020-01-09 08:13dmiguelezFixed in Version => 3.0PR20Q2
2020-03-20 17:54hudsonbotCheckin
2020-03-20 17:54hudsonbotNote Added: 0118724

Notes
(0116683)
AtulOpenbravo   
2020-01-08 09:43   
Test Plan

1. Login as F&B International
2. Create a New Costing Rule
   Organization : F&B US, Inc,
   Costing Algorithm: Average
   Fix BackDate : Y
3. Create New Product : Product A, Organization : F&B US, Inc. , Type : Item, Stocked = Yes
4. Create Physical Inventory (1st)
   Movement Date : Today,
   Product A, Qty 100, Cost: USD 1
   Warehouse : US East Cost
5. Create another Physical Inventory (2nd)
   Movement Date : Today +1,
   Product A, Qty : 200, Cost USD 1.5
   Warehouse : US East Cost
6. Schedule Costing Background process in Process Request.
7. Check that Product A has Total Stock : 200, Avg Cost USD 1.25
8. Create a Goods Movement
   Movement Date : Today,
   Product A, Qty 20,
   From Us East Cost To US West Cost
9. Execute Costing Background Process
10. Go to Window Product, select Product A, go to tab transaction, there are 4 transaction there,
11. Check the total cost for M+ & M-.
 * M- is 20 (This is correct)
 * M+ is 20 (This is correct)
12. Check average costs:
 * M+ avg is 1
 * 2nd Inv. Avg is 1.25
This is correct.
(0116714)
hgbot   
2020-01-09 08:12   
Repository: erp/devel/pi
Changeset: 7443fbd2b22481ddf912d350cf01420359d0d393
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Tue Jan 07 18:37:21 2020 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/7443fbd2b22481ddf912d350cf01420359d0d393 [^]

Fixes BUG-42515:Wrong cost calculated for backdated goods movements

**Implement a method to get cost adjustment amount from related
Movement From Transaction to consider it into the outgoing
Movement To Transaction

---
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
---
(0116715)
hgbot   
2020-01-09 08:12   
Repository: erp/devel/pi
Changeset: a7b87d4144703b58dbf34ad346a29a56b2aee72f
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Wed Jan 08 18:36:44 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/a7b87d4144703b58dbf34ad346a29a56b2aee72f [^]

Related to Issue 42515: Code Review changes

* Added final modifiers to variables and parameters
* Combined logic of if clauses into one and extracted the condition
  into a different method
* Use a query to retrieve the TransactionCosts instead of looping
  throught the generated .getList method and then filter the results.

---
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
---
(0116716)
dmiguelez   
2020-01-09 08:13   
Code Review + Testing Ok
(0118724)
hudsonbot   
2020-03-20 17:54   
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/b31620115262 [^]
Maturity status: Test