From c6140197d26728637ddeef3c8745e46ffa8ea50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Dec 2017 17:27:03 +0100 Subject: [PATCH] Set context on Report.execute Setting the context on Report._get_records does not work because the records are not actually instantiated on the call but later so the context is lost. issue7031 review36931002 --- invoice.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/invoice.py b/invoice.py index 0ad1a488ef..148c3f0840 100644 --- a/invoice.py +++ b/invoice.py @@ -2360,19 +2360,15 @@ class InvoiceReport(Report): def execute(cls, ids, data): pool = Pool() Invoice = pool.get('account.invoice') - result = super(InvoiceReport, cls).execute(ids, data) - if len(ids) == 1: - invoice, = Invoice.browse(ids) - if invoice.number: - result = result[:3] + (result[3] + ' - ' + invoice.number,) - return result - - @classmethod - def _get_records(cls, ids, model, data): with Transaction().set_context( language=False, address_with_party=True): - return super(InvoiceReport, cls)._get_records(ids, model, data) + result = super(InvoiceReport, cls).execute(ids, data) + if len(ids) == 1: + invoice, = Invoice.browse(ids) + if invoice.number: + result = result[:3] + (result[3] + ' - ' + invoice.number,) + return result @classmethod def get_context(cls, records, data):