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

Module: Argentina - Accounting

Entity: res.partner

Compute Method: _compute_l10n_ar_afip_identification

Inputs Method Outputs
  • state_id
  • state_id.code
""" The identification the partner is invoiced with, its preferred identifier paired
        with the AFIP code describing which document it is."""
for partner in self:
            vals = partner._get_preferred_legal_entity_identifier_vals()
            if not vals:
                afip_code = None
            elif vals['key'] == 'AR_CI':
                afip_code = AR_STATE_TO_CI_AFIP_CODE.get(partner.state_id.code)
            else:
                is_cuit = 'AR' in (vals.get('countries') or []) and vals.get('category') in TIN_CATEGORIES
                afip_code = AR_AFIP_CODES.get(vals['key']) or (AR_CUIT_AFIP_CODE if is_cuit else AR_FOREIGN_ID_AFIP_CODE)
            partner.l10n_ar_afip_code = afip_code
            partner.l10n_ar_afip_id_value = vals.get('value')

Back to entity