diff --git a/CHANGELOG b/CHANGELOG index b1be102423..dbafbcd829 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add context to export CSV route + Version 5.6.0 - 2020-05-04 * Bug fixes (see mercurial logs for details) * Call getter function when accessing Function field on unsaved record diff --git a/trytond/ir/routes.py b/trytond/ir/routes.py index bc7e89f35c..addfa84098 100644 --- a/trytond/ir/routes.py +++ b/trytond/ir/routes.py @@ -191,6 +191,15 @@ def data(request, pool, model): request.args.get('d', '[]'), object_hook=JSONDecoder()) except json.JSONDecodeError: abort(HTTPStatus.BAD_REQUEST) + try: + ctx = json.loads( + request.args.get('c', '{}'), object_hook=JSONDecoder()) + except json.JSONDecoder: + abort(HTTPStatus.BAD_REQUEST) + for key in list(ctx.keys()): + if key.startswith('_') and key != '_datetime': + del ctx[key] + context.update(ctx) limit = None offset = 0 if 's' in request.args: