Community mailing list archives

Re: stock.history total quantity and stock.quant total doesn't match

- 04/06/2016 05:47:22
stock_history is a bit dumb, you may have at least 2 problems with it:
- it's computed using all stock moves, which meas a single error long ago will provoke bad results
- does not take pack operations into account, so the locations reported are wrong if you use put away strategies or automatic reservations in sub-locations.

We've worked on the subject of valuation a bit lately (check for example).
It fixes the 1st problem, not the 2nd.

We could improve it further to fix the 2nd problem and make a clean module but we have nou funding for that.
If there is interest we may run a fundraiser.

Side note: if you're doing a *sales* dashboard you should probably not use the *inventory* history. They have nothing in common in Odoo.


Le 04/04/2016 11:17, aasim ansari a écrit :

Based on my research, I feel output of the following 2 queries should be the same-
SELECT SUM(qty) FROM stock_quant WHERE product_id=%s AND location_id=%s GROUP BY product_id

SELECT SUM(quantity) FROM stock_history h WHERE h.product_id=%s AND h.location_id=%s GROUP BY h.product_id

However, for some products it is not. If I have missed anything do let me know.

I am developing comprehensive Daily Sales Report module and would like community's input in finding the best way out.



Aasim Ahmed Ansari

Cell: +91 9619 424 386

Post to: