From 0fab57e4eb6637d10e55f473d405b514b8becd0b Mon Sep 17 00:00:00 2001 From: paso-odoo Date: Fri, 30 Jun 2023 06:20:08 +0000 Subject: [PATCH] [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 Signed-off-by: Parth Solanki (paso) --- addons/l10n_es_edi_tbai/models/account_edi_format.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/l10n_es_edi_tbai/models/account_edi_format.py b/addons/l10n_es_edi_tbai/models/account_edi_format.py index 7dfb2d5fe7f..0ad18e3ecb1 100644 --- a/addons/l10n_es_edi_tbai/models/account_edi_format.py +++ b/addons/l10n_es_edi_tbai/models/account_edi_format.py @@ -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: