[FIX] stock: wrong sublocation condition to compute new orderpoints
The condition to decide which moves to consider to create new orderpoints is incorrect. For example any move from a location that is sublocation of the main warehouse location should be considered as a out move. The inverse condition doesn't make much sense. closes odoo/odoo#157459 X-original-commit: 7c123a5c1d8ed8bf856d4701a972f59737323646 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
committed by
William Henrotin
parent
2f847c4629
commit
e71b1a27c0
@@ -377,9 +377,9 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
path = {loc: loc.parent_path for loc in self.env['stock.location'].with_context(active_test=False).search([('id', 'child_of', all_replenish_location_ids.ids)])}
|
||||
for loc in all_replenish_location_ids:
|
||||
for product in all_product_ids:
|
||||
qty_available = sum(q[1] for q in quants.get(product, [(0, 0)]) if q[0] and path[q[0]] in loc.parent_path)
|
||||
incoming_qty = sum(m[1] for m in moves_in.get(product, [(0, 0)]) if m[0] and path[m[0]] in loc.parent_path)
|
||||
outgoing_qty = sum(m[1] for m in moves_out.get(product, [(0, 0)]) if m[0] and path[m[0]] in loc.parent_path)
|
||||
qty_available = sum(q[1] for q in quants.get(product, [(0, 0)]) if q[0] and loc.parent_path in path[q[0]])
|
||||
incoming_qty = sum(m[1] for m in moves_in.get(product, [(0, 0)]) if m[0] and loc.parent_path in path[m[0]])
|
||||
outgoing_qty = sum(m[1] for m in moves_out.get(product, [(0, 0)]) if m[0] and loc.parent_path in path[m[0]])
|
||||
if float_compare(qty_available + incoming_qty - outgoing_qty, 0, precision_rounding=rounding[product.id]) < 0:
|
||||
# group product by lead_days and location in order to read virtual_available
|
||||
# in batch
|
||||
|
||||
Reference in New Issue
Block a user