diff options
| author | RomainLibert <rli@odoo.com> | 2019-09-17 08:00:57 +0000 |
|---|---|---|
| committer | RomainLibert <rli@odoo.com> | 2019-09-17 08:52:56 +0000 |
| commit | dde0746725d8791ad33807151ca8f9a49d813144 (patch) | |
| tree | b6920647f8faa30d15e7e000799c178692df1aeb /addons/web/controllers | |
| parent | a6ec6ca0e253a774d2c61f28bd3890b835892fbb (diff) | |
[FIX] web: avoid having context twice
In case the context was manually passed to report_download, #36839
would pass the context keyword argument twice to report_routes.
That is not allowed in python so we update the current context with the
custom context from the report and pop the custom context from the
arguments
closes odoo/odoo#36989
Signed-off-by: Romain Libert (rli) <rli@odoo.com>
Diffstat (limited to 'addons/web/controllers')
| -rw-r--r-- | addons/web/controllers/main.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8fabef0bf38..7803f658f39 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1833,8 +1833,11 @@ class ReportController(http.Controller): response = self.report_routes(reportname, docids=docids, converter=converter, context=context) else: # Particular report: - data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON - response = self.report_routes(reportname, converter=converter, context=context, **dict(data)) + data = dict(url_decode(url.split('?')[1]).items()) # decoding the args represented in JSON + if 'context' in data: + context, data_context = json.loads(context or '{}'), json.loads(data.pop('context')) + context = json.dumps({**context, **data_context}) + response = self.report_routes(reportname, converter=converter, context=context, **data) report = request.env['ir.actions.report']._get_report_from_name(reportname) filename = "%s.%s" % (report.name, extension) |
