diff --git a/aeat_mapping.py b/aeat_mapping.py
index 3c2f80a..471b7d8 100644
--- a/aeat_mapping.py
+++ b/aeat_mapping.py
@@ -38,7 +38,7 @@ class BaseTrytonInvoiceMapper(Model):
def counterpart_nif(self, invoice):
nif = ''
if invoice.party.tax_identifier:
- nif = invoice.party.tax_identifier
+ nif = invoice.party.tax_identifier.code
elif invoice.party.identifiers:
nif = invoice.party.identifiers[0].code
if nif.startswith('ES'):
diff --git a/invoice.py b/invoice.py
index b240f00..3ea36c3 100644
--- a/invoice.py
+++ b/invoice.py
@@ -160,15 +160,11 @@ class Invoice:
return res
def _set_sii_keys(self):
- tax = None
- for t in self.taxes:
- if t.tax.tax_used:
- tax = t.tax
- break
+ tax = self.taxes and self.taxes[0]
if not tax:
return
for field in _SII_INVOICE_KEYS:
- setattr(self, field, getattr(tax, field))
+ setattr(self, field, getattr(tax.tax, field))
@fields.depends(*_SII_INVOICE_KEYS)
def _on_change_lines_taxes(self):
diff --git a/party.py b/party.py
index 0e41d72..9ed6e40 100644
--- a/party.py
+++ b/party.py
@@ -29,4 +29,4 @@ class Party:
return identifier.code
return identifier.code[2:]
elif name == 'sii_vat_country':
- return identifier[:2]
+ return identifier.code[:2]
diff --git a/sii.xml b/sii.xml
index 7cc4cc2..43a2314 100644
--- a/sii.xml
+++ b/sii.xml
@@ -362,6 +362,7 @@ this repository contains the full copyright notices and license terms. -->
+
-
+ -->
E
01
diff --git a/tryton.cfg b/tryton.cfg
index 6c88f56..abb9f2e 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -3,8 +3,9 @@ version=4.2.0
depends:
account_invoice
account_invoice_company_currency
- account_es
+
extras_depend:
+ account_es
account_es_pyme
sale
purchase