From a8dc624635de9d19a24790cd80bb7c2c663e8893 Mon Sep 17 00:00:00 2001 From: "Paolo Gatti (pgi)" Date: Sun, 19 Feb 2023 21:13:07 +0000 Subject: [PATCH] [FIX] l10n_it_edi: cannot reset to draft moves sent to SdI If there's a l10n_it_edi_transaction id on the move, then the move has been sent to the SdI and it has received no rejection yet. So we avoid showing the Reset To Draft button in that case. Task link: https://www.odoo.com/web#id=3191726&model=project.task Task-3191726 closes odoo/odoo#113694 X-original-commit: dc088f2dabc369a3c7a00be7d20e81a56aeffef5 Signed-off-by: Josse Colpaert Signed-off-by: Paolo Gatti (pgi) --- addons/l10n_it_edi/models/account_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py index 66f860e2f9a..56b60c533d4 100644 --- a/addons/l10n_it_edi/models/account_invoice.py +++ b/addons/l10n_it_edi/models/account_invoice.py @@ -39,6 +39,12 @@ class AccountMove(models.Model): invoice.l10n_it_einvoice_id = einvoice.attachment_id invoice.l10n_it_einvoice_name = einvoice.attachment_id.name + @api.depends('l10n_it_edi_transaction') + def _compute_show_reset_to_draft_button(self): + super(AccountMove, self)._compute_show_reset_to_draft_button() + for move in self.filtered(lambda m: m.l10n_it_edi_transaction): + move.show_reset_to_draft_button = False + def invoice_generate_xml(self): self.ensure_one() report_name = self.env['account.edi.format']._l10n_it_edi_generate_electronic_invoice_filename(self)