TIP: You can type at any time to perform a new search.
Base Import Match
base_import_match · OCA/server-backend
- Repository
- OCA/server-backend · module folder · Try on Runboat
- Module version
- 1.0.0
- Category
- Tools
- Folder size
- 0.48 MB
- License
- AGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://github.com/OCA/server-backend
- Last tracking update
- 2026-08-07 08:43:03
- Authors
- Odoo Community Association (OCA), Tecnativa
- Maintainers
- Odoo Community Association (OCA), Tecnativa
- Committers
- Weblate, OCA-git-bot, oca-ci, Celina Devigili
- Odoo dependencies
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
- Description
By default, when importing data (like CSV import) with the `base_import` module, Odoo follows this rule: - If you import the XMLID of a record, make an **update**. - If you do not, **create** a new record. This module allows you to set additional rules to match if a given import is an update or a new record. This is useful when you need to sync heterogeneous databases, and the field you use to match records in those databases with Odoo's is not the XMLID but the name, VAT, email, etc. After installing this module, the import logic will be changed to: - If you import the XMLID of a record, make an **update**. - If you do not: - If there are import match rules for the model you are importing: - Discard the rules that require fields you are not importing. - Traverse the remaining rules one by one in order to find a match in the database. - Skip the rule if it requires a special condition that is not satisfied. - If one match is found: - Stop traversing the rest of valid rules. - **Update** that record. - If zero or multiple matches are found: - Continue with the next rule. - If all rules are exhausted and no single match is found: - **Create** a new record. - If there are no match rules for your model: - **Create** a new record. By default 2 rules are installed for production instances: - One rule that will allow you to update companies based on their VAT, when `is_company` is `True`. - One rule that will allow you to update users based on their login. In demo instances there are more examples.
Code Analysis ⓘ
Views touched (3)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
match_form_view |
Import match form view | base_import.match | form | New |
match_search_view |
Import match search view | base_import.match | search | New |
match_tree_view |
Import match list view | base_import.match | list | New |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (3)
New fields (0)
No new fields.
Public methods (1)-
load(self, fields, data)@api.modelTry to identify rows by other pseudo-unique keys. It searches for rows that have no XMLID specified, and gives them one if any :attr:`~.field_ids` combination is found. With a valid XMLID in place, Odoo will understand that it must *update* the record instead of *creating* a new one.
New fields (5)
-
field_idsOne2many → base_import.match.fieldcomodel_name='base_import.match.field'help='Fields that will define an unique key.'inverse_name='match_id'required=Truestring='Fields' -
model_idMany2one → ir.modeldomain=[('transient', '=', False)]help='In this model you will apply the match.'ondelete='cascade'required=True args: 'ir.model', 'Model' -
model_nameCharindex=Truerelated='model_id.model'store=Truestring='Model name' -
nameCharcompute='_compute_name'index=Truestore=True -
sequenceIntegerindex=True
No public methods.
New fields (6)
-
conditionalBooleanhelp='Enable if you want to use this field only in some conditions.' -
field_idMany2one → ir.model.fieldscomodel_name='ir.model.fields'domain="[('model_id', '=', model_id)]"help='Field that will be part of an unique key.'ondelete='cascade'required=Truestring='Field' -
imported_valueCharhelp="If the imported value is not this, the whole matching rule will be discarded. Be careful, this data is always treated as a string, and comparison is case-sensitive so if you set 'True', it will NOT match '1' nor 'true', only EXACTLY 'True'." -
match_idMany2one → base_import.matchcomodel_name='base_import.match'ondelete='cascade'required=Truestring='Match' -
model_idMany2onerelated='match_id.model_id' -
nameCharrelated='field_id.name'
No public methods.
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
- Status
- Open migration PR — not merged yet for this version
- CI status
- green — ready to merge
- Open since
- 55 days ago
- Last activity
- 34 days ago
- Repository
- OCA/server-backend
- Pull request
- [19.0][MIG] base_import_match: Migration to 19.0 (#467)