[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
291561a197
This commit is contained in:
Denis Ledoux
2016-06-13 19:00:03 +02:00
parent 2d47ea2563
commit c95e46eedb
+4 -1
View File
@@ -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():