From 35104ee3606ed6e140aeb5bcb5f7093618a704ee Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 1 Sep 2016 18:11:03 +0200 Subject: [PATCH] [FIX] account: fix reset to draft report deletion When removing the "Save as Attachment Prefix" field of the Invoice report (`account.report_invoice`), it was no longer possible to reset the invoice to draft opw-687130 --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 55a721fa1f7..47e5da9af7c 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -522,7 +522,7 @@ class AccountInvoice(models.Model): report_invoice = self.env['report']._get_report_from_name('account.report_invoice') except IndexError: report_invoice = False - if report_invoice: + if report_invoice and report_invoice.attachment: for invoice in self: with invoice.env.do_in_draft(): invoice.number, invoice.state = invoice.move_name, 'open'