From c95e46eedbee7f9919bda35309fc6beb189bc8a4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 13 Jun 2016 18:57:46 +0200 Subject: [PATCH] [FIX] account: invoice reset to draft when the default report is removed When the report `account.report_invoice` was being deleted, it was no longer possible to reset an invoice to draft. This is related to revision 291561a19741f81cdd2c6ba42a228f02d670c24e --- addons/account/models/account_invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index a92d0b7ea22..57d5c570428 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -521,7 +521,10 @@ class AccountInvoice(models.Model): self.delete_workflow() self.create_workflow() # Delete former printed invoice - report_invoice = self.env['report']._get_report_from_name('account.report_invoice') + try: + report_invoice = self.env['report']._get_report_from_name('account.report_invoice') + except IndexError: + report_invoice = False if report_invoice: for invoice in self: with invoice.env.do_in_draft():