From ec543bd6e1fe6a24b36257a0fc65c0c1dd393aec Mon Sep 17 00:00:00 2001 From: Simon COLLIN Date: Wed, 17 Apr 2024 11:37:56 +0200 Subject: [PATCH 1/2] fix: do not throw error if the line is a note or a section --- l10n_pt_vat/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_pt_vat/models/account_move.py b/l10n_pt_vat/models/account_move.py index beba7f1d..d6001fcb 100644 --- a/l10n_pt_vat/models/account_move.py +++ b/l10n_pt_vat/models/account_move.py @@ -57,7 +57,7 @@ def action_post(self): lambda x: x.country_code == "PT" and x.is_sale_document() ): exempt_lines = invoice.invoice_line_ids.filtered( - lambda x: not x.tax_ids.filtered("amount") + lambda x: x.display_type not in ['line_section','line_note'] and not x.tax_ids.filtered("amount") ) if exempt_lines and not invoice.l10npt_vat_exempt_reason: raise exceptions.ValidationError( From 0cfac232669cd804ee9c6c95fdc11cb6d194da59 Mon Sep 17 00:00:00 2001 From: Simon COLLIN Date: Wed, 17 Apr 2024 11:57:00 +0200 Subject: [PATCH 2/2] fix black error --- l10n_pt_vat/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/l10n_pt_vat/models/account_move.py b/l10n_pt_vat/models/account_move.py index d6001fcb..80b9f6b6 100644 --- a/l10n_pt_vat/models/account_move.py +++ b/l10n_pt_vat/models/account_move.py @@ -57,7 +57,8 @@ def action_post(self): lambda x: x.country_code == "PT" and x.is_sale_document() ): exempt_lines = invoice.invoice_line_ids.filtered( - lambda x: x.display_type not in ['line_section','line_note'] and not x.tax_ids.filtered("amount") + lambda x: x.display_type not in ["line_section", "line_note"] + and not x.tax_ids.filtered("amount") ) if exempt_lines and not invoice.l10npt_vat_exempt_reason: raise exceptions.ValidationError(