Skip to content
Snippets Groups Projects
Commit 11d3376f authored by Hoang Tran's avatar Hoang Tran
Browse files

[IMP] stock: improve traceability report perf


When checking if a line in traceability report is unfoldable,
`_get_move_lines` is a costly operation and should be executed last when
all other conditions are satisfied.

closes odoo/odoo#107843

X-original-commit: b40e0ea6
Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
parent 5ad97677
Branches
Tags
No related merge requests found
......@@ -185,7 +185,7 @@ class MrpStockReport(models.TransientModel):
lines = self._get_move_lines(move_line, line_id=line_id)
for line in lines:
unfoldable = False
if line.consume_line_ids or ( line.lot_id and self._get_move_lines(line) and model != "stock.production.lot"):
if line.consume_line_ids or (model != "stock.production.lot" and line.lot_id and self._get_move_lines(line)):
unfoldable = True
final_vals += self._make_dict_move(level, parent_id=line_id, move_line=line, unfoldable=unfoldable)
return final_vals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment