[FIX] account: fix traceback when resetting invoice to draft (#17262)

Due to a bad refactoring of this method during the remove of the
'report' module, a traceback occurs when resetting an invoice to draft.
This is due to the retrieve_attachment method that is used as an api.model
instead of api.multi.
This commit is contained in:
Laurent Smet
2017-05-29 16:05:49 +02:00
committed by GitHub
parent 26e88569c5
commit e06b039642
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -571,7 +571,7 @@ class AccountInvoice(models.Model):
for invoice in self:
with invoice.env.do_in_draft():
invoice.number, invoice.state = invoice.move_name, 'open'
attachment = self.env['ir.actions.report'].retrieve_attachment(invoice.id)
attachment = self.env.ref('account.account_invoices').retrieve_attachment(invoice)
if attachment:
attachment.unlink()
return True
+1 -1
View File
@@ -179,7 +179,7 @@ class IrActionsReport(models.Model):
#--------------------------------------------------------------------------
# Main report methods
#--------------------------------------------------------------------------
@api.model
@api.multi
def retrieve_attachment(self, record_id, attachment_name=None):
'''Retrieve an attachment for a specific record.