Skip to content

Commit b69340b

Browse files
committed
[FIX] stock: reset final_barcode template variable
**Problem**: When `lot['lot_record'].product_id.valid_ean` is `False`, the `final_barcode` variable retains the value from the previous iteration. This leads to incorrect concatenation with the current `lot['name']` when `lot['lot_record'].product_id.tracking == 'lot'`. **Solution**: Reset the `final_barcode` variable at the start of each iteration. **Steps to Reproduce**: 1. Go to Inventory > Settings and enable "Print GS1 Barcodes for Lots & Serial Numbers". 2. Navigate to Inventory > Products > Lots/Serial Numbers. 3. Select all records and click Print > Lot/Serial Number (ZPL). 4. Observe that some barcodes incorrectly include the previous barcode as a prefix. opw-4437745 closes odoo#192651 Signed-off-by: William Henrotin (whe) <[email protected]>
1 parent 7390f15 commit b69340b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

addons/stock/report/product_templates.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
^FO100,100
4848
^A0N,44,33^FDLN/SN: <t t-out="lot['name']"/>^FS
4949
<t t-if="env.user.has_group('stock.group_stock_lot_print_gs1')">
50+
<t t-set="final_barcode" t-value="''" />
5051
<t t-if="lot['lot_record'].product_id.valid_ean" t-set="final_barcode" t-value="'01' + '0' * (14 - len(lot['lot_record'].product_id.barcode)) + lot['lot_record'].product_id.barcode"/>
5152
<!-- TODO: must keep lot/sn as last value in barcode because we cannot pad '0's without changing lot/sn name until we can scan in FNC1. -->
5253
<t t-if="lot['lot_record'].product_id.tracking == 'lot'" name="datamatrix_lot" t-set="final_barcode" t-value="(final_barcode or '') + '10' + lot['name']"/>

0 commit comments

Comments
 (0)