[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) <tic@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
This commit is contained in:
Mathieu Walravens
2024-04-19 16:58:44 +00:00
parent 33f7006737
commit 7386def0e5
@@ -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