我在Odoo10中创建了一个具有json类型的公共路由,并试图从API ( ARC)调用它,我得到了404未找到的错误。我也不知道原因。
这是我的密码
controller.py
# -*- coding: utf-8 -*-
from odoo import http,tools
from odoo.http import request, Response
import requests
class TestURL(http.Controller):
@http.route('/create_lead', type="json", method=['POST'], auth='public', csrf=False)
def createLead(self,**kw):
print('Inside create lead')
// rest of the code here下面是我在api客户机中得到的响应:
{"jsonrpc": "2.0", "id": null, "error": {"message": "404: Not Found", "code": 404, "data": {"debug": "Traceback (most recent call last):\n File \"/home/user/Projects/odoo-10/odoo/http.py\", line 642, in _handle_exception\n return super(JsonRequest, self)._handle_exception(exception)\n File \"/home/user/Projects/odoo-10/odoo/http.py\", line 1471, in _dispatch_nodb\n func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match()\n File \"/usr/local/lib/python2.7/dist-packages/werkzeug/routing.py\", line 1581, in match\n raise NotFound()\nNotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\n", "exception_type": "internal_error", "message": "404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.", "name": "werkzeug.exceptions.NotFound", "arguments": []}, "http_status": 404}}发布于 2020-02-27 17:23:59
试一试
@http.route(['/create_lead']...检查压痕
https://stackoverflow.com/questions/60435490
复制相似问题