From 7386def0e5e22fc6f61ff6874ce5b65dd45024a9 Mon Sep 17 00:00:00 2001 From: Mathieu Walravens Date: Mon, 15 Apr 2024 16:29:47 +0200 Subject: [PATCH] [FIX] stock,iot: incorrect docids in ZPL label layout wizard Steps to reproduce: 1. Go to IoT > Devices 2. Select a device and add the report "Lot/Serial Number (ZPL)" 3. Create a product tracked by lots 4. Purchase 5 units of this product 5. Validate the reception (with a lot) 6. Print labels > Lot/SN Labels - Quantity to print: One per unit - Format: ZPL Labels Before this commit: When printing labels for multiple lots of the same product, the wizard was incorrectly generating the docids as a `list[list[int]]`. It works correctly as the ids are joined thanks to JavaScript magic. However, when sending the report to an IoT device, the ids are sent as-is in the context, which raises and error when calling `browse()`. After this commit: The docids are now generated as a flat list of integers, which is correct and works as expected. opw-3850631 closes odoo/odoo#162063 Signed-off-by: Tiffany Chang (tic) Signed-off-by: Walravens Mathieu (wama) --- addons/stock/wizard/stock_lot_label_layout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_lot_label_layout.py b/addons/stock/wizard/stock_lot_label_layout.py index 4898008e09b..4e09072d233 100644 --- a/addons/stock/wizard/stock_lot_label_layout.py +++ b/addons/stock/wizard/stock_lot_label_layout.py @@ -36,7 +36,7 @@ class ProductLabelLayout(models.TransientModel): quantity_by_lot[move_line.lot_id.id] += 1 docids = [] for lot_id, qty in quantity_by_lot.items(): - docids.append([lot_id] * qty) + docids.extend([lot_id] * qty) report_action = self.env.ref(xml_id).report_action(docids, config=False) report_action.update({'close_on_report_download': True}) return report_action