Skip to content

Commit 7ac7652

Browse files
committed
stock_quant_history_snapshot: improve logging messages
1 parent c3d2112 commit 7ac7652

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

stock_quant_history/models/stock_quant_history_snapshot.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ def _generate_stock_quant_history(self):
114114

115115
self.previous_snapshot_id = previous_quant_snapshot
116116
if previous_quant_snapshot.stock_quant_history_ids.exists():
117-
_logger.info("Duplicate previous stock.quant.history...")
117+
_logger.info(
118+
"Duplicate %s previous stock.quant.history...",
119+
len(previous_quant_snapshot.stock_quant_history_ids),
120+
)
118121
for stock_quant_history in previous_quant_snapshot.stock_quant_history_ids:
119122
# copy is around 3x slower than create !
120123
quant_copy = quant_history[
@@ -126,14 +129,17 @@ def _generate_stock_quant_history(self):
126129
]
127130
quant_copy.quantity = stock_quant_history.quantity
128131

129-
_logger.info("Apply stock.move.line since previous snapshot")
130-
for move_line in (
132+
stock_move_lines = (
131133
self.env["stock.move.line"]
132134
.sudo()
133135
.search(
134136
self._prepare_stock_move_line_filter(previous_quant_snapshot),
135137
)
136-
):
138+
)
139+
_logger.info(
140+
"Apply %s stock.move.line since previous snapshot", len(stock_move_lines)
141+
)
142+
for move_line in stock_move_lines:
137143
quant_history[
138144
(move_line.product_id, move_line.lot_id, move_line.location_id)
139145
].quantity -= move_line.qty_done

0 commit comments

Comments
 (0)