|
|
""" 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')
|
|