[FIX] product: print all product labels when multiple tracked products
Steps to reproduce:
- Create 2 SN tracked products
- Create a receipt of the 2 products, with a demand qty of 2+ of
each product
- Create the SNs of the incoming products + validate picking
- Print Labels > 2x7 or 4x12 (with or without price) > confirm
Expected result:
2+ labels per product printed, 1 for each SN
Actual result:
Only 1st label of the 2nd product is printed, all of labels of the 1st
product are printed
Issue:
The "quantity" in:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L155-L156
is structured as:
{product, [(barcode_to_print, qty_to_print), ...], ...}
or in this case:
{product2: [(product2_sn1, 1), (product2_sn2, 1), ...], product1: [(product1_sn1, 1), (product1_sn2, 1), ...]}
So there was a miscounting where:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L162-L164
Would set the current_quantity to 0 (since only 1 per SN barcode)
And:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L155-L156
would register the not (current_quantity=0) as true and quantity={product1: (...),...}
as true => move onto the next product rather than checking if there
are any more (barcode, qty) tuples to print, i.e. never reach:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L166-L167
for product2 and therefore never reach its (sn,qty) labels beyond it's
first one.
Note that this issue does not occur for the dymo or zpl labels because
they follow different, less complicated templates
opw-3199095
closes odoo/odoo#114972
X-original-commit: 54e587b272a52972a0f615a29005dcb6fdb6992f
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>