[6.1][7.0][trunk] _product_reserve result is not correct
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Medium
|
OpenERP R&D Addons Team 2 |
Bug Description
_product_reserve (stock/stock.py) does not take linked moved into account for computation.
It results in a total mess when using mrp module as a "mrp.production" object when confirmed will always create two moves (the first for the procurement, and a second one that is in a 'waiting' state and attached to the stock.picking list used to check production start availability) for each product line:
"Stock -> Stock" linked to "Stock -> Production" via "move_dest_id" field
The BIG problem is that "_product_reserve" is doing this:
Counted value INCREASED (++) for : location_id <> stock AND location_dest_id = stock AND state='done'
Counted value DECREASED (--) for : location_id == stock AND location_dest_id <> stock AND state in ('done', 'assigned')
As you can see, the first move will never be taken into account, even if assigned because "location_id == location_dest_id" and the second move is also ignored because it is in a 'waiting' state.
In practice, the final issue is that a product procurement is always valid (if Quantity On Hand > 0.0):
"from stock: products assigned."
but the quantity is permanently decreased without exception from procurement.
So actually, the MRP module cannot be used.
tags: | added: warehouse |
UP, I think that it's a major issue, it was a source of multiple stock errors in our company, we are using a dirty fix to avoid this but this issue must be reviewed by a stock move expert.