Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Partner DUNS

Entity: res.partner

Compute Method: _compute_same_duns_partner_id

View 18.0
Inputs Method Outputs
  • duns
  • parent_id
  • company_id
  • company_id.id
- for partner in self:
-             if not partner.duns or partner.parent_id:
-                 partner.same_duns_partner_id = False
-                 continue
-             # NOTE: use _origin to deal with onchange()
-             partner_id = partner._origin.id
-             domain = [
-                 ("duns", "=", partner.duns),
-                 ("company_id", "in", [False, partner.company_id.id]),
-             ]
-             if partner_id:
-                 domain += [
-                     ("id", "!=", partner_id),
-                     "!",
-                     ("id", "child_of", partner_id),
-                 ]
-             # NOTE: active_test=False because if a partner has been deactivated you
-             # still want to show the warning, so that you can reactivate it instead
-             # of creating a new one, which would loose its history.
-             Partner = self.with_context(active_test=False).sudo()
-             partner.same_duns_partner_id = Partner.search(domain, limit=1)
  • same_duns_partner_id

Back to entity