Browse Source

fixup! [ADD] duplicate treatment

pull/988/head
Holger Brunn 7 years ago
parent
commit
a22452a716
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 12
      base_import_odoo/models/import_odoo_database.py

12
base_import_odoo/models/import_odoo_database.py

@ -335,10 +335,18 @@ class ImportOdooDatabase(models.Model):
continue
if isinstance(record, list):
record = record[0]
records = model.with_context(active_test=False).search([
domain = [
(field.name, '=', record.get(field.name))
for field in mapping.field_ids
], limit=1)
if record.get(field.name)
]
if len(domain) < len(mapping.field_ids):
# play it save, only use mapping if we really select
# something specific
continue
records = model.with_context(active_test=False).search(
domain, limit=1,
)
if records:
_id = records.id
context.idmap[(model._name, record['id'])] = _id

Loading…
Cancel
Save