Remove country code when is eu VAT
This commit is contained in:
parent
669a773978
commit
4082cb2ee5
|
@ -35,10 +35,12 @@ class BaseTrytonInvoiceMapper(Model):
|
|||
exempt_kind = attrgetter('sii_excemption_key')
|
||||
|
||||
def counterpart_nif(self, invoice):
|
||||
nif = invoice.party.identifiers[0].code
|
||||
if nif.startswith('ES'):
|
||||
nif = nif[2:]
|
||||
return nif
|
||||
if invoice.party.identifiers:
|
||||
nif = invoice.party.identifiers[0].code
|
||||
if nif.type == 'eu_vat':
|
||||
return nif[2:]
|
||||
return nif
|
||||
return ''
|
||||
|
||||
counterpart_id_type = attrgetter('party.sii_identifier_type')
|
||||
counterpart_id = counterpart_nif
|
||||
|
|
6
party.py
6
party.py
|
@ -21,6 +21,8 @@ class Party:
|
|||
def get_sii_vat_data(self, name=None):
|
||||
if self.vat_code:
|
||||
if name == 'sii_vat_code':
|
||||
return self.vat_code[-9:]
|
||||
return (self.vat_code[-9:]
|
||||
if self.type == 'eu_vat' else self.vat_code)
|
||||
elif name == 'sii_vat_country':
|
||||
return self.vat_code[:2]
|
||||
return (self.vat_code[:2]
|
||||
if self.type == 'eu_vat' else None)
|
||||
|
|
Loading…
Reference in New Issue