[FIX] stock_account_quantity_history_location: location filter

When filtering svl by location we don't want to let outgoing svls out.
Normally, we want all the location's related movements to get the whole
picture.

TT35218
This commit is contained in:
david
2022-03-18 17:40:10 +01:00
committed by Pedro M. Baeza
parent 8403ed5ff1
commit ff35894f2d

View File

@@ -29,10 +29,23 @@ class StockQuantityHistory(models.TransientModel):
)
action["context"] = ctx
if self.env.context.get("active_model") == "stock.valuation.layer":
operator = "child_of" if self.include_child_locations else "="
action["domain"] = expression.AND(
[
action["domain"],
[("stock_move_id.location_dest_id", "=", self.location_id.id)],
[
"|",
(
"stock_move_id.location_dest_id",
operator,
self.location_id.id,
),
(
"stock_move_id.location_id",
operator,
self.location_id.id,
),
],
]
)
return action