[FIX] l10n_es_edi_tbai: check company vat for sender

If the vat is not set on the company and calls the method of web service
parameters for Bizkaia, it will raise an AttributeError like the 'bool' object
has no attribute 'startswith'.

Fix this issue by adding a condition to check the company's vat.

Sentry - 4282481635

closes odoo/odoo#127954

X-original-commit: 2eb66299a2edc5dd5194a7ea7a2ef208a135d533
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
This commit is contained in:
paso-odoo
2023-07-11 06:52:57 +02:00
parent 62bdd7adae
commit 0fab57e4eb
@@ -81,6 +81,10 @@ class AccountEdiFormat(models.Model):
if not invoice.company_id.mapped('l10n_es_tbai_tax_agency')[0]:
errors.append(_("Please specify a tax agency on your company for TicketBAI."))
# Ensure a vat is available.
if not invoice.company_id.vat:
errors.append(_("Please configure the Tax ID on your company for TicketBAI."))
# Check the refund reason
if invoice.move_type == 'out_refund':
if not invoice.l10n_es_tbai_refund_reason: