Skip to content
Health
67/100
fair
  • Security25/25
    No findings
  • Activity12/25
    Last human commit 17 months ago
  • Required by5/25
    0 modules depend on it
  • Maturity25/25
    In 11 Odoo series since 8.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
0
Modules depending on it
External deps
0 pip · 0 bin
Python packages / system binaries
License
AGPL-3
No conflicts with its dependencies
Folder size
0.48 MB
Module directory on disk
Code analysis 0 migration notes 3 models 3 views 0 HTTP endpoints

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.

Dependencies

Odoo dependencies
odoo/odoo:
- web
Python dependencies
None
System dependencies
None
Required by
None

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

Views touched 3

XML IDNameModelTypeStatus
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.model
    Try 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_ids One2many → base_import.match.field
    comodel_name='base_import.match.field' help='Fields that will define an unique key.' inverse_name='match_id' required=True string='Fields'
  • model_id Many2one → ir.model
    domain=[('transient', '=', False)] help='In this model you will apply the match.' ondelete='cascade' required=True args: 'ir.model', 'Model'
  • model_name Char
    index=True related='model_id.model' store=True string='Model name'
  • name Char
    compute='_compute_name' index=True store=True
  • sequence Integer
    index=True
Public methods (0)

No public methods.

New fields (6)
  • conditional Boolean
    help='Enable if you want to use this field only in some conditions.'
  • field_id Many2one → ir.model.fields
    comodel_name='ir.model.fields' domain="[('model_id', '=', model_id)]" help='Field that will be part of an unique key.' ondelete='cascade' required=True string='Field'
  • imported_value Char
    help="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_id Many2one → base_import.match
    comodel_name='base_import.match' ondelete='cascade' required=True string='Match'
  • model_id Many2one
    related='match_id.model_id'
  • name Char
    related='field_id.name'
Public methods (0)

No public methods.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…