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
This commit is contained in:
Cédric Krier
2017-12-26 17:27:03 +01:00
parent 6d8dc227b7
commit c6140197d2
+6 -10
View File
@@ -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):