[trunk] incorrect stock accounting valuations using standard cost

Bug #923191 reported by Graeme Gellatly
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

in purchase module stock.py the method _get_reference_accounting_values_for_valuation is incorrectly overridden.

to reproduce.
Set a product as standard cost of $1.00
Raise a purchase order for this product at $1.50 * 10

Expected entries
Stock dr $10
Stock Input cr $10

Results
$15 in each.

if using standard cost the correct valuation at receipting time is the products standard cost * quantity. this is the whole point of using standard cost in the first place. However this override cause the stock valuation calculation to become po line price * qty. When products are sold downstream this will cause an error in stock valuation.

The line
if move.product_id.cost_method != 'average' or not move.price_unit:

should be changed, probably to

if move.product_id.cost_method == 'average' and not move.price_unit:

but in truth, this function could just be deleted entirely as there is no condition where this should evaluate to true, and even if it did, it is safer to take the standard_price which already occurs than just assume that the po_line is the correct price as the scale of potential errors is significantly smaller with the former and po's have no accounting entries.

In any case, with standard accounting it makes no difference, and with anglosaxon the price difference is picked up at invoice. Note that this bug is a root cause of the symptons of bug 922077

Related branches

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Graeme,

I have checked your issue at my end . but it's working fine for me .
For your more reference ,I have attached video. please go throw it.
If you still faced the problem , notify us .

Thanks!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

Please ravish.

Can you read the entire discussion,ççYou try in a video one thing TOTALLY different we are trying to exlain this.

ALL discussion is about accounting stuff, not what you trying.

Regards.

Changed in openobject-addons:
status: Incomplete → Confirmed
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hi Graeme,

Thank you for your detailed analysis. You're absolutely correct and I agree that removing the unnecessary override is the best solution. For average costing the PO price is already made available via the default receipt cost of the picking/move receipt wizard, so we don't need anything else. The cost should always be properly set on the move once it's been received, and we can simply use it.

The fix has landed in trunk (6.1) at revision 6461 rev-id: <email address hidden>

BTW until this case is properly covered by a YAML test we should not consider it really fixed. If anyone from the community would like to contribute on this topic, please make a merge proposal to complement the current YAML tests with a minimalist case checking a scenario similar to the one in the bug description. The test should fail before revision 6461, and pass afterwards.

Thanks for the excellent bug report!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
milestone: none → 6.1
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.