Stock valuation misscalculation for product quantities with more than 2 decimal positions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Committed
|
Medium
|
OpenERP R&D Addons Team 3 |
Bug Description
Using OpenERP 7.0, Postgres 9.1, modules warehouse, account, and mrp_jit
Steps to reproduce the error:
1. Create a Product "A" of type stockable, costing method average price, and set proper accounts for stock valuation in the product category.
2. Create a Stock Move (Menu Warehouse/
Cause of error: I think the problem is related to stock valuation, although the inventory move is saved with 3 decimal positions the field quantity in account.move.line is saved with only 2 decimal positions (saves 9.04). Then the product quantity (product.product) is also updated with only 2 decimal positions (9.04).
Could you please help confirm this is a bug and provide tip on how to fix it?
Related branches
- Amit Parik (community): Approve
-
Diff: 12 lines (+1/-1)1 file modifiedaccount/account_move_line.py (+1/-1)
summary: |
- Automatic inventory valuation works only with two decimal positions + Stock valuation misscalculation for product quantities with more than 2 + decimal positions |
Changed in openobject-addons: | |
assignee: | nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3) |
importance: | Undecided → Medium |
status: | New → Confirmed |
Dear Amit,
I think I've solved the issue, I've already tested it succesfully! :). As it represent changes to the core modules I would appreciate your support in testing again and merging.
For solving the issue it was needed to properly set the "Rounding Precision" of the related Unit of Meassure (associated to the product) to 0.001 which means 3 decimal positions (explained just in case someone else has this trouble). It fixed the quantity shown in the product form "A", now it shows the expected 9.043.
Still one problem remains which needs change in code as follows: The field quantity in account.move.line is still saved with only 2 decimal positions (saves 9.04) the following fix is needed on the base code:
#file addons/ account/ account_ move_line, line 436 float(' Quantity' , digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."), float(' Quantity' , digits_ compute= dp.get_ precision( 'Product Unit of Measure'), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."),
-- 'quantity': fields.
++ 'quantity': fields.
Best Regards,
Andres Calle
TRESCLOUD Cia Ltda