barcode.rule: fields, relations and API
The barcode.rule model ("Barcode Rule") is a persistent model declared by the Barcode module, then extended by 4 other modules. It exposes 17 fields, 11 of them declared directly on the model. Below you will find every field with its technical name, type, label and relations, followed by an Odoo 19 JSON-2 API call.
Model identity
- Technical name
barcode.rule- Label
- Barcode Rule
- Type
- Persistent (models.Model)
- SQL table
barcode_rule- Origin module
- Barcode (
barcodes) - Extended by
- barcodes_gs1_nomenclature, stock, point_of_sale, pos_loyalty
- Default order (_order)
sequence asc, id
Model fields
11 own fields, 0 inherited from mixins and 6 automatic ORM fields. Click a name to get a direct link to that field.
17 of 17 fields shown
| Technical name | Label | Type | Details |
|---|---|---|---|
| alias | Alias The matched pattern will alias to this barcode | char | required |
| associated_uom_id | Associated Uom | many2one→ uom.uom | added by Barcode - GS1 Nomenclature ( |
| barcode_nomenclature_id | Barcode Nomenclature | many2one | |
| encoding | Encoding This rule will apply only if the barcode is encoded with the specified encoding | selection | required Values: |
| gs1_content_type | GS1 Content Type The GS1 content type defines what kind of data the rule will process the barcode as: * Date: the barcode will be converted into a Odoo datetime; * Measure: the barcode's value is related to a specific unit; * Numeric Identifier: fixed length barcode following a specific encoding; * Alpha-Numeric Name: variable length barcode. | selection | Values: added by Barcode - GS1 Nomenclature ( |
| gs1_decimal_usage | Decimal If True, use the last digit of AI to determine where the first decimal is | boolean | added by Barcode - GS1 Nomenclature ( |
| is_gs1_nomenclature | Is Gs1 Nomenclature | boolean | related: added by Barcode - GS1 Nomenclature ( |
| name | Rule Name An internal identification for this barcode nomenclature rule | char | required |
| pattern | Barcode Pattern The barcode matching pattern | char | required |
| sequence | Sequence Used to order rules such that rules with a smaller sequence match first | integer | |
| type | Type | selection | required Values: |
| create_date | Created on | datetime | read-onlyautomatic |
| create_uid | Created by | many2one | read-onlyautomatic |
| display_name | Display Name | char | read-onlycomputedautomatic |
| id | ID | integer | read-onlyautomatic |
| write_date | Last Updated on | datetime | read-onlyautomatic |
| write_uid | Last Updated by | many2one | read-onlyautomatic |
Relations
Models linked from this model
- barcode.nomenclature: barcode_nomenclature_id
- uom.uom: associated_uom_id
Fields of other models pointing here
No Many2one or Many2many field of another model points to this model.
Reading this model through the API
Odoo 19 JSON-2 API call reading the first five records with real fields of the model. Replace the instance, database and API key with your own.
curl -X POST "https://your-instance.odoo.com/json/2/barcode.rule/search_read" \
-H "Authorization: bearer $ODOO_API_KEY" \
-H "X-Odoo-Database: your-db" \
-H "Content-Type: application/json" \
-d '{"domain":[],"fields":["name","alias","encoding","pattern","type"],"limit":5}'import requests
BASE_URL = "https://your-instance.odoo.com/json/2"
headers = {"Authorization": f"bearer {API_KEY}", "X-Odoo-Database": "your-db"}
res = requests.post(
f"{BASE_URL}/barcode.rule/search_read",
headers=headers,
json={"domain": [], "fields": ["name","alias","encoding","pattern","type"], "limit": 5},
)
res.raise_for_status()
print(res.json())- External API access requires Odoo's Custom plan.
- XML-RPC and JSON-RPC will be removed in Odoo 22 (fall 2028): use JSON-2.
- The access rights and record rules of the key's user apply.
Cite this tool
Writing a tutorial, internal documentation or a forum answer? Copy this link to send your readers to the up-to-date reference.
<a href="https://aidoo.ai/en/outils/explorateur-modeles-odoo/barcode-rule">barcode.rule (Odoo 19.0)</a>Sources
Data verified on September 23, 2026 · Odoo 19.0 Community
Have an Odoo project, or want to put your ERP to work with AI? Let's talk
Implementation, custom module development, connecting Claude or ChatGPT to your data: tell us about your context and we will reply within 24 business hours.