Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034055Openbravo ERP04. Warehouse managementpublic2016-09-22 13:062016-12-16 18:37
ngarcia 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q1 
aferraz
Core
No
0034055: Wrong cost adjustment is made when stock reaches 0 but stock valuation is not 0 due to rounding issues
Wrong cost adjustment is made when stock reaches 0 but stock valuation is not 0 due to rounding issues.

Should the stock valuation be 0 once the stock is 0 although there is not any new entry in the warehouse?
As system admin role:
   Set Cost Precision of the currency to 6
As group admin role:
   Set the following two preferences as Y:
      Allow to persist Unit Cost
      Enable Negative Stock Corrections
   Create a new product
   Create a physical inventory and add the previously created product:
      Quantity count: 19
      Cost: 26.24069
   Create two Goods Shipments: one of 10 units and one of 9 units
   Launch the Costing Background Process
   Check the Stock is 0.00 and Stock Valuation is 0.00 in Product - Unit Cost tab
   Launch the Reset Unit Cost process and check Stock Valuation is updated to -0.01, which is wrong.
   Create a new physical inventory:
      Quantity count: 19
      Cost: null
   Launch the Costing Background Process
   Check the Stock is 19 and the Stock Valuation is 498.55378
   Launch the Reset Unit Cost process and check the Stock is updated to 38, which is wrong.
No tags attached.
related to defect 0034099 scheduled AtulOpenbravo Different precision in database than in UI for Unit Cost field of Product - Unit Cost tab 
depends on defect 0034068 closed markmm82 Stock valuation is updated to 0 when the stock if 0 by the Reset Unit Cost process but not by Costing Background Process 
has duplicate defect 0034056 closed markmm82 Wrong stock in Unit Cost tab of Product window 
Issue History
2016-09-22 13:06ngarciaNew Issue
2016-09-22 13:06ngarciaAssigned To => Triage Finance
2016-09-22 13:06ngarciaModules => Core
2016-09-22 13:06ngarciaResolution time => 1476309600
2016-09-22 13:06ngarciaTriggers an Emergency Pack => No
2016-09-22 13:06ngarciaIssue Monitored: networkb
2016-09-22 13:11ngarciaRelationship addedrelated to 0034056
2016-09-22 13:11ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13156#r13156
2016-09-22 13:12ngarciaNote Added: 0090166
2016-09-22 13:20ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13157#r13157
2016-09-23 10:32ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13169#r13169
2016-09-28 12:38aferrazAssigned ToTriage Finance => markmm82
2016-09-29 17:20markmm82Statusnew => scheduled
2016-10-10 18:41aferrazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13347#r13347
2016-10-10 18:49aferrazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13348#r13348
2016-10-10 18:53aferrazRelationship replacedhas duplicate 0034056
2016-10-10 18:54aferrazRelationship addeddepends on 0034068
2016-10-10 18:55aferrazRelationship addedrelated to 0034099
2016-10-11 15:02aferrazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13353#r13353
2016-10-11 15:12aferrazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13354#r13354
2016-10-11 18:21markmm82Note Added: 0090538
2016-10-17 16:56aferrazNote Edited: 0090538bug_revision_view_page.php?bugnote_id=0090538#r13389
2016-10-17 17:03hgbotCheckin
2016-10-17 17:03hgbotNote Added: 0090643
2016-10-17 17:03hgbotStatusscheduled => resolved
2016-10-17 17:03hgbotResolutionopen => fixed
2016-10-17 17:03hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9a17396e89b4a64f565bb9822a8e9bdd88384255 [^]
2016-10-17 17:03hgbotCheckin
2016-10-17 17:03hgbotNote Added: 0090644
2016-10-17 18:09hgbotCheckin
2016-10-17 18:09hgbotNote Added: 0090646
2016-10-17 18:22aferrazNote Edited: 0090538bug_revision_view_page.php?bugnote_id=0090538#r13390
2016-10-17 18:24aferrazReview Assigned To => aferraz
2016-10-17 18:24aferrazNote Added: 0090648
2016-10-17 18:24aferrazStatusresolved => closed
2016-10-17 18:24aferrazFixed in Version => 3.0PR17Q1
2016-12-16 18:37hudsonbotCheckin
2016-12-16 18:37hudsonbotNote Added: 0092525
2016-12-16 18:37hudsonbotCheckin
2016-12-16 18:37hudsonbotNote Added: 0092526
2016-12-16 18:37hudsonbotCheckin
2016-12-16 18:37hudsonbotNote Added: 0092527

Notes
(0090166)
ngarcia   
2016-09-22 13:12   
During the analysis of this issue, it should be checked if an adjustment should be done in the moment the stock reaches 0 in order the valuation to become 0 too
(0090538)
markmm82   
2016-10-11 18:21   
(edited on: 2016-10-17 18:22)
Test Plan
As system admin role:
   Set Cost Precision of the currency to 6
As group admin role:
   1. Set the following two preferences as Y:
      Allow to persist Unit Cost
      Enable Negative Stock Corrections
   2. Create a new product
   3. Create a physical inventory and add the previously created product:
      Quantity count: 19
      Cost: 26.24069
   4. Launch the Costing Background Process
      Check the Stock is 19 and Stock Valuation is 498.57311 in Product - Unit Cost tab
   5. Launch the Reset Unit Cost process and check values remain the same
   6. Create two Goods Shipments: one of 10 units and one of 9 units
   7. Launch the Costing Background Process
   8. Check the Stock is 0.00 and Stock Valuation is 0.00 in Product - Unit Cost tab
   9. Launch the Reset Unit Cost process and check values remain the same
   10. Create a new physical inventory:
      Quantity count: 19
      Cost: null
   11.Launch the Costing Background Process
      Check the Stock is 19 and Stock Valuation is 498.56378.
   12. Launch the Reset Unit Cost process and check the Stock is 19 and Stock Valuation is 498.55378.

(0090643)
hgbot   
2016-10-17 17:03   
Repository: erp/devel/pi
Changeset: 9a17396e89b4a64f565bb9822a8e9bdd88384255
Author: Mark <markmm82 <at> gmail.com>
Date: Tue Oct 11 15:10:05 2016 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/9a17396e89b4a64f565bb9822a8e9bdd88384255 [^]

Fixes issue 34055: Fixed errors in Costing Background due to rounding issues.

When cost adjustments are created, they should not be taken into account when Stock Valuation is initialized because it duplicates the stock amount (caused by natural union between tables) inside M_INITIALIZE_STOCK_VALUATION function.

---
M src-db/database/model/functions/M_INITIALIZE_STOCK_VALUATION.xml
---
(0090644)
hgbot   
2016-10-17 17:03   
Repository: erp/devel/pi
Changeset: 839a52f407fcb6188b0eb4e45456c50a55d2ddaa
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Oct 17 17:00:58 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/839a52f407fcb6188b0eb4e45456c50a55d2ddaa [^]

Related to issue 34055: Code review improvements

Set zero valuation in case stock is zero and it does not exist any record in m_stock_valuation.
Do not sum transaction movementqty, to avoid duplicate stock in case we have more than one m_transaction_cost record related to the same transaction.

---
M src-db/database/model/functions/M_INITIALIZE_STOCK_VALUATION.xml
M src-db/database/model/functions/M_UPDATE_STOCK_VALUATION.xml
---
(0090646)
hgbot   
2016-10-17 18:09   
Repository: erp/devel/pi
Changeset: d52eb3542b99b40a33d79e7634a777cd5ae6635c
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Oct 17 18:08:57 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d52eb3542b99b40a33d79e7634a777cd5ae6635c [^]

Related to issue 34055: Remove isunitcost condition

Remove isunitcost condition in M_INITIALIZE_STOCK_VALUATION query.

---
M src-db/database/model/functions/M_INITIALIZE_STOCK_VALUATION.xml
---
(0090648)
aferraz   
2016-10-17 18:24   
Code review + Testing OK
(0092525)
hudsonbot   
2016-12-16 18:37   
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/dc8bf00badd0 [^]
Maturity status: Test
(0092526)
hudsonbot   
2016-12-16 18:37   
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/dc8bf00badd0 [^]
Maturity status: Test
(0092527)
hudsonbot   
2016-12-16 18:37   
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/dc8bf00badd0 [^]
Maturity status: Test