Comment 7 for bug 372045

Revision history for this message
Ferdinand (office-chricar) wrote :

let's forget V5 for this....

please see an issue just happened
https://bugs.launchpad.net/openobject-addons/+bug/636899

in trunk stock.py I see
1894 if move.product_id.cost_method == 'average' and move.price_unit:
1895 amount = q * move.price_unit

I strongly suggest to store this amount - I called it
move_value_cost (and move_value_sales ) and would be happy if you could take this term as agreed on the accounting expert list.

and calculate move.price_unit = move_value_cost / q or store it too ( it's cheap)
it does not make much sense (performance) to do a q * move.price_unit every time OpenERP reads stock_moves and this is done every time OpenERP opens a product.

the move_value_cost is exactly the amount which will be used directly or as aggregate in the accounting.

and we must make sure that stock_accounting values match exactly accounting values.

and sum(q * move.price_unit) is likely to be different from sum(move_value_cost) especially if this is done once in python and once in psql and for summing up some 100.000 records I hope we will use psql.

hope this clarifies the issue.