Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0cf2ccf

Browse filesBrowse files
committed
XMLRPC to controler
1 parent a4c1a0e commit 0cf2ccf
Copy full SHA for 0cf2ccf

File tree

Expand file treeCollapse file tree

1 file changed

+17
-13
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-13
lines changed

‎controllers/controllers.py

Copy file name to clipboardExpand all lines: controllers/controllers.py
+17-13Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,37 @@
1010
from odoo import http
1111
from odoo.http import request
1212
import re
13+
import xmlrpc.client
1314

1415
_logger = logging.getLogger(__name__)
1516
CORS = '*'
1617

1718

1819
class OdooApiXMLRPC(http.Controller):
1920
# version #
21+
'''
22+
import ipdb; ipdb.set_trace()
23+
bash entrypoint.sh --dev reload
24+
common = xmlrpc.client.ServerProxy('http://127.0.0.1:8069/xmlrpc/2/common')
25+
common.version()
26+
uid = common.authenticate(db, login, password, {})
27+
'''
28+
29+
# def __init__(self):
30+
# super().__init__()
31+
# self.common = xmlrpc.client.ServerProxy('http://127.0.0.1:8069/xmlrpc/2/common')
32+
2033
@http.route('/odoo-api/common/version', type="json", auth='none', cors=CORS)
2134
def odoo_api_version(self, **kw):
22-
version = odoo.release.version.split('.')
23-
# Try int ( error on Odoo 12 )
24-
try:
25-
server_version_info = [int(version[0]), int(version[1]), 0, "final", 0]
26-
except:
27-
server_version_info = [str(version[0]), str(version[1]), 0, "final", 0]
28-
29-
return {
30-
"server_version": version[0] + "." + version[1],
31-
"server_version_info": server_version_info,
32-
"server_serie": version[0] + "." + version[1],
33-
"protocol_version": 1,
34-
}
35+
common = xmlrpc.client.ServerProxy('http://127.0.0.1:8069/xmlrpc/2/common')
36+
return common.version()
3537

3638
# login #
3739
@http.route('/odoo-api/common/login', type="json", auth='none', cors=CORS)
3840
def odoo_api_login(self, db=None, login=None, password=None, **kw):
3941
try:
42+
# uid = self.common.authenticate(db, login, password, {})
43+
# another way :
4044
uid = request.session.authenticate(db, login, password)
4145
return {
4246
"user_uid": uid,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.