|
|
""" The identification the partner is invoiced with, its preferred identifier paired
with the SUNAT code (catálogo 06) describing which document it is. """
for partner in self:
vals = partner._get_preferred_legal_entity_identifier_vals()
if not (sunat_code := PE_SUNAT_CODES.get(vals.get('key'))):
if 'PE' in (vals.get('countries') or []) and vals.get('category') in TIN_CATEGORIES:
sunat_code = PE_RUC_SUNAT_CODE
elif vals and vals.get('category') not in TIN_CATEGORIES:
sunat_code = PE_FOREIGN_ID_SUNAT_CODE
else:
sunat_code = PE_FOREIGN_VAT_SUNAT_CODE
partner.l10n_pe_sunat_id_code = sunat_code
partner.l10n_pe_sunat_id_value = vals.get('value')
|
|