Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ddmrp_exclude_moves_adu_calc/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ def _exclude_past_moves_domain(self):

@api.model
def _past_moves_domain(self, date_from, date_to, locations):
new_locs = locations.filtered(lambda loc: not loc.exclude_from_adu)
# NOTE: do not use .filtered(...) for two reasons:
# - number of locations could be high
# - prefetch is retrieving too much columns when accessing .exclude_from_adu
# (with_prefetch=False improves a bit, but not as much as a search)
new_locs = self.env["stock.location"].search(
[("id", "in", locations.ids), ("exclude_from_adu", "=", False)]
)
res = super()._past_moves_domain(date_from, date_to, new_locs)
if self.env.context.get("ddmrp_move_include_excluded"):
return res
Expand Down