Monday, April 21, 2025
1 change · saas-18.1
Resolved issues and error corrections
Creating new maintenance equipment could fail when GS1 barcode rules were enabled and no barcode value was present. This fix safely handles missing or invalid barcode values, allowing users to create equipment records without interruption.
Original PR description
The error is caused when the the barcode is `False` in the function `parse_barcode` when creating a new maintenance equipment after changing default barcode nomenclature to `GS1 nomenclature`. `map_gs1_barcode` proceeds to throw same error when error handling is only done for `parse_barcode` hence we need to handle it as well. **Steps to reproduce:** * Install Maintenance and Inventory * Inventory>Configuration>Settings>Barcode Nomenclature * Set to `Default GS1 Nomenclature` * Maintenance App>Equipment>New `TypeError: expected string or bytes-like object` **Solution:** * Check if barcode is a string before proceeding in `parse_barcode` function for regex. * Wrap `re.match` in try and except if it throws an type error set `match = None` and proceed as usual for `map_gs1_barcode` such that it does not throw error the same regex error. Sentry-6552593535 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr