many2many_barcode_tags
Tags for barcodes, with one change: when a quick-create hits a duplicate barcode, the error is allowed to surface instead of being quietly handled.
| Technical name | many2many_barcode_tags |
|---|---|
| Field types | many2many |
| Views | form |
| Module | stock, the Inventory app |
| Used in core | 1 occurrence, the barcodes field on the unit of measure form in stock |
| Versions | Odoo 20.0, Odoo 19.0 |
| No-code setup | No. Studio offers plain tags; this variant is set in view XML |
| Alternatives | many2many_tags, many2one_barcode, many2many_tags_avatar |
What the barcode tags field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
no_quick_create | boolean | Inherited from the tags widget. Removes creation from the typed text entirely, which sidesteps the situation this widget handles.(default: false) |
no_create | boolean | Inherited. Removes both creation paths from the dropdown.(default: false) |
create_name_field | field | Inherited. Field the typed text is written into when quick-creating a tag. |
color_field | field | Inherited from the tags widget. Names an integer field used to color the tags. |
The error test looks at debug information. The widget decides whether an error is a uniqueness violation by inspecting the error's debug payload for the database driver's constraint name. That payload is present in the situations this widget was written for, but it is not guaranteed, so the behavior degrades to the standard fallback rather than failing.
Working examples
Letting one error through
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Byte-identical to Odoo 19 on the development branch. |
| Odoo 19.0 | Verified | First version. Verified against the shipped source. |
| Odoo 18.0 | Not available | Widget does not exist. The field used the plain tags widget. |
| Odoo 17.0 | Not available | Widget does not exist. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. The widget is new in Odoo 19. On Odoo 18 and earlier the barcodes field used the plain tags widget, so an upgrade gains the behavior with the standard inventory views and nothing needs migrating.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| A duplicate barcode still opens a creation dialog | The error's debug payload did not contain the constraint marker the widget tests for. Check whether debug information is being suppressed on that deployment; the widget falls back to standard behavior without it. |
| The error message is not user friendly | The widget only stops the error being converted into a dialog; it does not rewrite the message. Add a server-side constraint with a clear message if the wording matters. |
| Users can still create duplicates | They are not duplicates as far as the database is concerned, for example differing by whitespace. Normalize the value server side before the constraint applies. |
| Quick create is unavailable | An inherited option disabled it. Remove no_quick_create if creating from typed text is wanted. |
| Missing widget error | The stock module is not installed in that database. Install Inventory, or use the plain tags widget. |
Barcode tags field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
many2many_barcode_tags | Tag fields where a database uniqueness constraint is the likely reason a quick create fails | Rethrows uniqueness violations instead of falling back to a creation dialog |
| many2many_tags | Most tag fields | Offers a creation dialog whenever a quick create fails, whatever the cause |
| many2one_barcode | Scanning a single related record | A relation picker with scanning, not a tag list |
| many2many_tags_avatar | Tags representing people | Avatars rather than plain tags, with standard error handling |
Frequently asked questions
What does many2many_barcode_tags change?+
Why does that matter for barcodes?+
How does it recognize the error?+
Does it produce a nicer error message?+
Which versions have it?+
Barcodes that scan to exactly one thing
Barcode design, unit of measure setup and the scanning flows on top of them decide whether your warehouse app speeds people up or slows them down. We implement Odoo Inventory and Barcode on versions 16 through 19.
Book a free consultation