[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
This commit is contained in:
Denis Ledoux
2016-09-01 18:12:44 +02:00
parent 665bb3cb62
commit 35104ee360
+1 -1
View File
@@ -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'