diff --git a/odoo/addons/base/models/ir_http.py b/odoo/addons/base/models/ir_http.py index e7613af207a..ab2f903183d 100644 --- a/odoo/addons/base/models/ir_http.py +++ b/odoo/addons/base/models/ir_http.py @@ -194,7 +194,12 @@ class IrHttp(models.AbstractModel): return serve # Don't handle exception but use werkzeug debugger if server in --dev mode - if 'werkzeug' in tools.config['dev_mode'] and not isinstance(exception, werkzeug.exceptions.NotFound): + # Don't intercept JSON request to respect the JSON Spec and return exception as JSON + # "The Response is expressed as a single JSON Object, with the following members: + # jsonrpc, result, error, id" + if ('werkzeug' in tools.config['dev_mode'] + and not isinstance(exception, werkzeug.exceptions.NotFound) + and request._request_type != 'json'): raise exception try: