From a3f102db491e2cdcbb0c62ae5abf0afd2674a1d0 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 17 Feb 2020 14:17:28 +0000 Subject: [PATCH] [FIX] l10n_it_edi: allow invoice edit after edi sent Create an invoice, validate it, sending the data to the SDI. Now reset to draft the invoice and re-validate it. Action will be blocked because "You can't regenerate an E-Invoice when the first one is sent and there are no errors". This add the possibility to modify the invoice without re-sending it as long as the first one is still in a sent-with-no-answer state opw-2196956 closes odoo/odoo#45580 X-original-commit: a315d7dde7ab4c1283c999c336284aeac86dbbbc Signed-off-by: Nicolas Martinelli (nim) --- addons/l10n_it_edi/models/account_invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py index 54c0a8177c2..387e6655289 100644 --- a/addons/l10n_it_edi/models/account_invoice.py +++ b/addons/l10n_it_edi/models/account_invoice.py @@ -52,7 +52,10 @@ class AccountMove(models.Model): super(AccountMove, self).post() # Retrieve invoices to generate the xml. - invoices_to_export = self.filtered(lambda move: move.company_id.country_id == self.env.ref('base.it') and move.is_sale_document()) + invoices_to_export = self.filtered(lambda move: + move.company_id.country_id == self.env.ref('base.it') and + move.is_sale_document() and + move.l10n_it_send_state not in ['sent', 'delivered', 'delivered_accepted']) invoices_to_export.write({'l10n_it_send_state': 'other'}) invoices_to_send = self.env['account.move']