diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 52ad468d7a8..8c0d227e02d 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -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 diff --git a/odoo/addons/base/ir/ir_actions_report.py b/odoo/addons/base/ir/ir_actions_report.py index 299b6624921..55620a5407b 100644 --- a/odoo/addons/base/ir/ir_actions_report.py +++ b/odoo/addons/base/ir/ir_actions_report.py @@ -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.