From e06b039642d8add0e4e8b752cabcc63403fa0a49 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Mon, 29 May 2017 16:05:49 +0200 Subject: [PATCH] [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. --- addons/account/models/account_invoice.py | 2 +- odoo/addons/base/ir/ir_actions_report.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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.