[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) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-02-18 08:16:57 +00:00
parent 2ee19575be
commit a3f102db49
+4 -1
View File
@@ -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']