By default, when importing data (like CSV import) with the ``base_import``
module, Odoo follows this rule:
1. If you import the XMLID of a record, make an **update**.
2. 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:
1. If you import the XMLID of a record, make an **update**.
2. If you do not:
1. If there are import match rules for the model you are importing:
1. Discard the rules that require fields you are not importing.
2. Traverse the remaining rules one by one in order to find a match in
the database.
1. If one match is found:
1. Stop traversing the rest of valid rules.
2. **Update** that record.
2. If zero or multiple matches are found:
1. Continue with the next rule.
3. If all rules are exhausted and no single match is found:
1. **Create** a new record.
2. If there are no match rules for your model:
1. **Create** a new record.
Testing fingerprint, with ignore_finger_print set to False, caused an error, because it would first set
ignore_fingerprint to False, then validate, never getting to actually setting the fingerprint, causing the
following stacktrace:
Traceback (most recent call last):
File "/home/travis/build/OCA/server-backend/base_external_system/tests/test_external_system.py", line 28, in test_check_fingerprint_allowed
self.record.write({"ignore_fingerprint": False, "fingerprint": "Data"})
File "/home/travis/odoo-13.0/odoo/models.py", line 3573, in write
fields[0].determine_inverse(real_recs)
File "/home/travis/odoo-13.0/odoo/fields.py", line 1122, in determine_inverse
self.inverse(records)
File "/home/travis/odoo-13.0/odoo/fields.py", line 594, in _inverse_related
target[field.name] = record_value[record]
File "/home/travis/odoo-13.0/odoo/models.py", line 5629, in __setitem__
return self._fields[key].__set__(self, value)
File "/home/travis/odoo-13.0/odoo/fields.py", line 1087, in __set__
records.write({self.name: write_value})
File "/home/travis/odoo-13.0/odoo/models.py", line 3568, in write
real_recs._validate_fields(set(vals) - set(inverse_fields))
File "/home/travis/odoo-13.0/odoo/models.py", line 1176, in _validate_fields
check(self)
* In cases of deep inheritance, it may be required to create an adapter directly. Add an override in the create via the env context to support this.
* Add default system type if creating from an interface
* Fix interface assignment during creation in adapter
* [ADD] base_external_system: Implement interface/adapter for external systems
* base_external_system: Fix OS model, add inherits, add validate
* base_external_system: Usability and private key pass
* base_external_system: Use contextmanager in adapter client
* base_external_system: Move contextmanager to interface
* base_external_system: Include contextmanager on adapter and system
* base_external_system: Unify client
* Use password widget for password field
* Add tests & security
* Fix lint
* Add plaintext note