Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036831Openbravo ERP04. Warehouse managementpublic2017-09-11 18:362017-09-21 16:50
ngarcia 
AtulOpenbravo 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q4 
aferraz
Core
No
0036831: Wrong average cost after negative stock correction: Total Stock Valuation of Costing tab is not updated
Wrong average cost after negative stock correction: Total Stock Valuation of Costing tab is not updated
As group admin role:

   Set the Enable Negative Stock Correction preference to Y
   Log out and log in

   Check the costing rule for F&B US, Inc. is validated without Warehouse Dimension
   Create a new stocked product in F&B US, Inc.
   Add a price of 6USD in Be Soft Dinker Price List
   Create a Goods Receipt for F&B US East Coast, add 2 units of it and complete it
   Create a Physical Inventory for F&B US West Coast, add 1 unit of it a cost of 12 and process it
   Create a Goods Shipment for F&B US East Coast, add 2 units of it and complete it
   Launch the Costing Background Process and check a current average cost of 8 is obtained
 
   Create a new Costing Rule for F&B US, Inc. with Warehouse Dimension
   Validate it

   Create a Goods Receipt for F&B US East Coast, add 1 unit of it and complete it
   Create another Goods Receipt for F&B US East Coast, add 1 unit of it and complete it

   Launch the Costing Background Process again and check although the first average cost for US East Coast is 6USD and a negative stock correction of 4USD has been made against the related transaction (I+) the Total Stock Valuation is 2 (-4 + 6). Thus, the current stock valuation is 8 and the current average cost is 4USD (it should be 6USD)
Attached a possible fix that should be properly reviewed and tested.
No tags attached.
related to design defect 0036642 new Triage Omni WMS [Costing Migration Process] Stock valuation should be updated to 0 when the stock of the product is 0 
related to defect 00339683.0PR17Q1 closed dmiguelez Wrong costs calculated with Backdated Transactions 
related to backport 00298913.0PR15Q2.1 closed umartirena Wrong Total Movement quantity in the costing tab with backdated transactions 
diff 36831.diff (2,731) 2017-09-12 17:47
https://issues.openbravo.com/file_download.php?file_id=11057&type=bug
Issue History
2017-09-11 18:36ngarciaNew Issue
2017-09-11 18:36ngarciaAssigned To => Triage Finance
2017-09-11 18:36ngarciaModules => Core
2017-09-11 18:36ngarciaResolution time => 1506895200
2017-09-11 18:36ngarciaTriggers an Emergency Pack => No
2017-09-11 18:37ngarciaIssue Monitored: networkb
2017-09-11 18:40ngarciaRelationship addedrelated to 0036642
2017-09-12 14:37aferrazAssigned ToTriage Finance => markmm82
2017-09-12 14:50aferrazRelationship addedrelated to 0033968
2017-09-12 14:50aferrazRelationship addedrelated to 0029891
2017-09-12 17:47aferrazFile Added: 36831.diff
2017-09-12 17:50aferrazProposed Solution updated
2017-09-15 13:28aferrazAssigned Tomarkmm82 => AtulOpenbravo
2017-09-18 14:35AtulOpenbravoStatusnew => scheduled
2017-09-18 14:38AtulOpenbravoNote Added: 0099117
2017-09-18 16:13AtulOpenbravoNote Added: 0099119
2017-09-18 18:20hgbotCheckin
2017-09-18 18:20hgbotNote Added: 0099130
2017-09-18 18:20hgbotStatusscheduled => resolved
2017-09-18 18:20hgbotResolutionopen => fixed
2017-09-18 18:20hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ff6e0aa17abcc50e6c3389ac6eff9514a1055c62 [^]
2017-09-18 18:56aferrazReview Assigned To => aferraz
2017-09-18 18:56aferrazNote Added: 0099131
2017-09-18 18:56aferrazStatusresolved => closed
2017-09-18 18:56aferrazFixed in Version => 3.0PR17Q4
2017-09-21 16:50hudsonbotCheckin
2017-09-21 16:50hudsonbotNote Added: 0099413

Notes
(0099117)
AtulOpenbravo   
2017-09-18 14:38   
Test Plan 36831
- Login with F&B International Group Admin role
- Set the Enable Negative Stock Correction preference to Y
- Log out and log in

- Check the costing rule for F&B US, Inc. is validated without Warehouse Dimension.
- Create a new stocked product in F&B US, Inc.
- Add a price of 6USD in Be Soft Drinker Price List.
- Create a Goods Receipt for F&B US East Coast, add 2 units of it and complete it.
- Create a Physical Inventory for F&B US West Coast, add 1 unit of it a cost of 12 and process it.
- Create a Goods Shipment for F&B US East Coast, add 2 units of it and complete it.
- Launch the Costing Background Process and check a current average cost of 8 is set for the product.
 
- Create a new Costing Rule for F&B US, Inc. with Warehouse Dimension
- Validate it.

- Create a Goods Receipt for F&B US East Coast, add 1 unit of it and complete it.
- Create another Goods Receipt for F&B US East Coast, add 1 unit of it and complete it.

- Realize that shipment from F&B US East Coast has total cost as 16 but the incoming cost was 12 so for the first receipt a adjustment of value -4 is done as Negative Stock Correction. Hence for costing line Total Movement Qty and Total Stock Valuation is set as empty and current average cost is 6. This is correct.

Same average cost 6 is also set for second receipt line.
(0099119)
AtulOpenbravo   
2017-09-18 16:13   
Test Plan 29891
- Login as F&B International Group Admin role
- Go to product window, create new record
  - Organization: F&B US Inc
  - Search Key: 29891
  - Name: test 29891
  - In Price Tab, add record for Be Soft Drinker price list
     Set Unit Price: 2, List Price: 2

- Go to Purchase order, create a new one for Be Soft Drinker
- In Lines tab, add test 29891 product, set Qty: 200, process order

- Go to Goods Receipt window, create record for Be Soft Drinker set movement date: two weeks ago
- select the order line created before and process it.

- Go to Purchase order, create a new one for Be Soft Drinker
- In Lines tab, add test 29891 product, set Qty: 380, process order

- Go to Goods Receipt window, create record for Be Soft Drinker, set movement date: today
- select the order line created before and process it

- Go to Purchase order, create a new one for Be Soft Drinker
- In Lines tab, add test 29891 product, set Qty: 100, process order

Go to Goods Receipt window, create record for Be Soft Drinker, set movement date: three weeks ago
- select the order line created before and process it

- Go to Costing rule window, for record with F&B US Inc Organization, Process Fix Backdated Transactions: date: 1 month ago

- Go to Process request and launch the costing background process
- Go to the Costing tab of the product: test 29891 product, sort records order by ending date
- Realise that the first line is: qty:100, second line qty:200, third line qty:380 and the total movement qty is empty for all three lines as there exists a adjustment entry of type backdated transaction.

- For costing line, check below tab Average Cost Transactions.
  - For three weeks ago goods receipt line Cumulative Qty = 100
  - For two weeks ago goods receipt line Cumulative Qty = 300
  - For three weeks ago goods receipt line Cumulative Qty = 680

- Add goods receipt for above product with Qty = 250 and process it.
- Launch costing background process.
- Check that costing line for fourth goods receipt has information as below

  Qty: 250
  Total Movement Qty: 930 (680 previous + 250 current)
  Total Stock Valuation: 1860

  This is correct.
(0099130)
hgbot   
2017-09-18 18:20   
Repository: erp/devel/pi
Changeset: ff6e0aa17abcc50e6c3389ac6eff9514a1055c62
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Sep 18 20:43:17 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/ff6e0aa17abcc50e6c3389ac6eff9514a1055c62 [^]

Fixes issue 36831: Wrong average cost after negative stock correction

Total stock valuation in Costing tab is not updated
after negative stock correction.

Check if total stock valuation has changed
same as we check if total movement quantity has changed.

When a cost adjustment is done, total stock valuation and
total movement quantity of affected cost will be set as zero,
in order to recalculate them properly next time a new cost is calculated.

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0099131)
aferraz   
2017-09-18 18:56   
Code review + Testing OK
(0099413)
hudsonbot   
2017-09-21 16:50   
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/9750b78d3e5c [^]
Maturity status: Test