I'm trying to integrate reactjs
with Odoo
, and successfully created components. Now my problem is that I cant get the JSON via odoo. The odoo programmer has to write special api request to make this happen. This is taking more time and code repetitions are plenty.
我正在尝试将reactjs与Odoo集成,并成功创建了组件。现在我的问题是我无法通过odoo获得JSON。 odoo程序员必须编写特殊的api请求来实现这一点。这需要更多的时间和代码重复是充足的。
I tried may suggestions and none worked.
我试过可能的建议,没有工作。
Is there a better way to convert the browse objects
, that odoo
generate, to JSON
?
有没有更好的方法将odoo生成的浏览对象转换为JSON?
Note: Entirely new to python and odoo, please forgive my mistakes, if any mentioned above.
注意:对于python和odoo来说,全新的,请原谅我的错误,如果有的话,如上所述。
1 个解决方案
#1
0
maybe this will help you:
也许这会对你有所帮助:
Step 1: Create js that runs reqiest to /example_link
步骤1:创建运行reqiest到/ example_link的js
Step 2: Create controller who listens that link @http.route('/example_link', type="json")
第2步:创建侦听链接的控制器@ http.route('/ example_link',type =“json”)
Step 3: return from that function json return json.dumps(res)
where res is python dictionary and also dont forget to import json.
第3步:从该函数返回json返回json.dumps(res),其中res是python字典,也不要忘记导入json。
Thats all, it's not very hard, hope I helped you, good luck.
多数民众赞成,这不是很难,希望我帮助你,祝你好运。
#1
0
maybe this will help you:
也许这会对你有所帮助:
Step 1: Create js that runs reqiest to /example_link
步骤1:创建运行reqiest到/ example_link的js
Step 2: Create controller who listens that link @http.route('/example_link', type="json")
第2步:创建侦听链接的控制器@ http.route('/ example_link',type =“json”)
Step 3: return from that function json return json.dumps(res)
where res is python dictionary and also dont forget to import json.
第3步:从该函数返回json返回json.dumps(res),其中res是python字典,也不要忘记导入json。
Thats all, it's not very hard, hope I helped you, good luck.
多数民众赞成,这不是很难,希望我帮助你,祝你好运。