[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 <jco@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
This commit is contained in:
Paolo Gatti (pgi)
2023-02-25 16:26:39 +01:00
parent 01489bfab5
commit a8dc624635
@@ -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)