Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
6627 Lượt xem

Hi! I have purchased the licence for a couple of modules using the 14 version of Odoo and the cloud hosted solution.


I'm trying to use the API in order to integrate Odoo with some external services I have.


Following the documentation: https://www.odoo.com/documentation/master/webservices/odoo.html


I cannot authenticate, when I try I get the following error:


Traceback (most recent call last):

  File "test.py", line 13, in <module>

    uid = common.login(db, username, password)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1243, in __call__

    return self.__send(self.__name, args)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1602, in __request

    verbose=self.__verbose

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1283, in request

    return self.single_request(host, handler, request_body, verbose)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1316, in single_request

    return self.parse_response(response)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1493, in parse_response

    return u.close()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 800, in close

    raise Fault(**self._stack[0])

xmlrpclib.Fault: <Fault 1: 'Traceback (most recent call last):\n  File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 69, in xmlrpc_2\n    response = self._xmlrpc(service)\n  File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc\n    result = dispatch_rpc(service, method, params)\n  File "/home/odoo/src/odoo/14.0/odoo/http.py", line 140, in dispatch_rpc\n    result = dispatch(method, params)\n  File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 56, in dispatch\n    return g[exp_method_name](*params)\n  File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 20, in exp_login\n    return exp_authenticate(db, login, password, None)\n  File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 25, in exp_authenticate\n    res_users = odoo.registry(db)[\'res.users\']\n  File "/home/odoo/src/odoo/14.0/odoo/__init__.py", line 104, in registry\n    return modules.registry.Registry(database_name)\n  File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 63, in __new__\n    return cls.registries[db_name]\n  File "/home/odoo/src/odoo/14.0/odoo/tools/func.py", line 71, in wrapper\n    return func(self, *args, **kwargs)\n  File "/home/odoo/src/odoo/14.0/odoo/tools/lru.py", line 34, in __getitem__\n    a = self.d[obj]\nTypeError: unhashable type: \'list\'\n'>


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Juan.

Did you solve it ?
I was starting with API last week.
It now works fine but I had to review some of my local settings to make it work.

Did you activate the API password on your instance ?

Best,

V.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I tried using the documentation:

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
version = common.version()

print(version)

uid = common.login(db, username, password)

print(uid)


I also tried the php connector and got the same result.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Can you add the code that you tried along with the question ? See the working of odoo xmlrpc, here: Odoo XMLRPC : Connect Odoo With External Applications


Also can you try with python 3 and see.


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 25
966
1
thg 8 25
1205
2
thg 7 25
3941
3
thg 7 25
1265
1
thg 6 25
2999