odoo Controller接口開發 POST請求的跨域問題解決方法
1、odoo Controller接口開發,前端在請求的時候會發生跨域問題,報錯信息如下:Function declared as capable of handling request of type 'json' but called with a request of type 'http'
2、解決方法如下: odoo官網給的參數解釋: cors – The Access-Control-Allow-Origin cors directive value. 可以在Controller接口上配置參數,如: @http.route("/", type='json', auth="none", csrf=False, method=["POST"],website=True, cors="*") 這樣前端在進行接口調用的時候,就可以調通了,跨域問題就解決了。