From 529885af364eb60de3f153eff2adf220b72ac9d6 Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Fri, 21 Jan 2022 17:02:38 +0100 Subject: [PATCH] [FIX] l10n_it_fatturapa_out: add check on invoice check for fiscal_document_type_id and parner_id.city --- l10n_it_fatturapa_out/models/account.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/l10n_it_fatturapa_out/models/account.py b/l10n_it_fatturapa_out/models/account.py index 69549a5de343..3d496bbbd656 100644 --- a/l10n_it_fatturapa_out/models/account.py +++ b/l10n_it_fatturapa_out/models/account.py @@ -55,6 +55,14 @@ def preventive_checks(self): % invoice.name ) + if not invoice.fiscal_document_type_id: + raise UserError( + _( + "Invoice %s fiscal document type must be set", + invoice.name, + ) + ) + if ( invoice.invoice_payment_term_id and invoice.invoice_payment_term_id.fatturapa_pt_id.code is False @@ -81,6 +89,9 @@ def preventive_checks(self): ) ) + if not invoice.partner_id.city: + raise UserError(_("Invoice %s partner city must be set", invoice.name)) + if not all( aml.tax_ids for aml in invoice.invoice_line_ids if aml.product_id ):