mirror of
https://gitlab.com/datalifeit/trytond-aeat_sii
synced 2023-12-13 20:30:37 +01:00
Get counterpart country from invoice address when not has vat country
This commit is contained in:
parent
ae38172404
commit
25f36d381b
|
@ -35,7 +35,6 @@ class BaseTrytonInvoiceMapper(Model):
|
|||
exempt_kind = attrgetter('sii_excemption_key')
|
||||
counterpart_nif = attrgetter('party.vat_number')
|
||||
counterpart_id_type = attrgetter('party.sii_identifier_type')
|
||||
counterpart_country = attrgetter('party.vat_country')
|
||||
counterpart_id = counterpart_nif
|
||||
untaxed_amount = attrgetter('untaxed_amount')
|
||||
total_amount = attrgetter('total_amount')
|
||||
|
@ -53,6 +52,12 @@ class BaseTrytonInvoiceMapper(Model):
|
|||
return tools.unaccent(invoice.lines[0].description)
|
||||
return self.serial_number(invoice)
|
||||
|
||||
def counterpart_country(self, invoice):
|
||||
if invoice.party.vat_country:
|
||||
return invoice.party.vat_country
|
||||
return (invoice.invoice_address.country.code
|
||||
if invoice.invoice_address.country else '')
|
||||
|
||||
def final_serial_number(self, invoice):
|
||||
try:
|
||||
SaleLine = self.pool.get('sale.line')
|
||||
|
|
Loading…
Reference in a new issue