summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Smet <las@openerp.com>2017-05-29 16:05:49 +0200
committerGitHub <noreply@github.com>2017-05-29 16:05:49 +0200
commite06b039642d8add0e4e8b752cabcc63403fa0a49 (patch)
tree8c47419a8d7ccb2a87f9c5c1906471494997a8e9
parent26e88569c58a3f393a632d6757593eeebbb24ff8 (diff)
[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.
-rw-r--r--addons/account/models/account_invoice.py2
-rw-r--r--odoo/addons/base/ir/ir_actions_report.py2
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.