Hello everyone,
In my module I have a controller type="json", how can I return a json of type {'code': 200} instead of returning an object of type jsonrpc :
{
"jsonrpc": "2.0",
"id": null,
"result": {
"code": 200,
}
}
Thanks for all!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello everyone,
In my module I have a controller type="json", how can I return a json of type {'code': 200} instead of returning an object of type jsonrpc :
{
"jsonrpc": "2.0",
"id": null,
"result": {
"code": 200,
}
}
Thanks for all!
Just edit below portion of the function _json_response defined at odoo/odoo11/odoo/http.py near about line no : 621-630 as below
def _json_response(self, result=None, error=None):
response = {
'jsonrpc': '2.0',
'id': self.jsonrequest.get('id')
}
if error is not None:
response['error'] = error
if result is not None:
response['result'] = result
to new:
def _json_response(self, result=None, error=None):
response = {}
if error is not None:
response = error
if result is not None:
response = result
Please do the procedure at your own risk. these procedure isn't a recommended procedure.
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
Best way to show json data on odoo UI
Rozwiązane
|
|
2
wrz 23
|
28655 | |
|
6
lip 20
|
11348 | ||
|
1
mar 20
|
3404 | ||
Odoo JSON Filter and Offset Parameter
Rozwiązane
|
|
5
sty 20
|
9304 | |
|
0
mar 17
|
4328 |