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

Module: Base

Entity: res.partner

Compute Method: _compute_available_additional_identifiers_metadata

View 20.0
Inputs Method Outputs
  • additional_identifiers
  • country_code
+ for partner in self:
+             stored_identifiers = partner.additional_identifiers or {}
+             vals = {
+                     # Resolve lazy translations now: JSON would otherwise stringify them in a frame where
+                     # no language can be detected.
+                 key: self._lazy_translate_additional_identifiers_metadata(metadata)
+                 for key, metadata in self._get_all_additional_identifiers_metadata().items()
+                 if not metadata.get('countries')
+                     or partner.country_code in metadata['countries']
+                     or key in stored_identifiers  # includes international, and any identifier already set on the record
+             }
+             if {key: metadata for key, metadata in vals.items() if metadata.get('category') == 'EN' and key != 'OTHER'}:
+                 # Pops out the default 'OTHER' only if another 'EN' identifier is available
+                 vals.pop('OTHER', None)
+             partner.available_additional_identifiers_metadata = vals
  • available_additional_identifiers_metadata

Back to entity