PyOdoo 0.7.2__tar.gz → 0.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PKG-INFO +13 -4
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PyOdoo.egg-info/PKG-INFO +13 -4
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PyOdoo.egg-info/SOURCES.txt +6 -4
- {pyodoo-0.7.2 → pyodoo-0.8.1}/README.md +9 -3
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/__init__.py +6 -1
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/active_status_choice.py +1 -1
- {pyodoo-0.7.2/pyodoo/v12 → pyodoo-0.8.1/pyodoo}/api.py +110 -18
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/boolean_operator.py +1 -1
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/compare_type.py +1 -1
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/constants.py +3 -3
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/filter.py +2 -2
- pyodoo-0.8.1/pyodoo/implementation.py +26 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/message_subtype.py +1 -1
- {pyodoo-0.7.2/pyodoo/v12 → pyodoo-0.8.1/pyodoo}/model.py +43 -36
- {pyodoo-0.7.2/pyodoo/v12 → pyodoo-0.8.1/pyodoo}/python_code.py +20 -13
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/awaitable.py +1 -1
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/contacts.py +8 -7
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/contacts_async.py +9 -7
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/python_code.py +11 -8
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/sql_excel_query.py +11 -8
- {pyodoo-0.7.2/pyodoo/v12 → pyodoo-0.8.1/pyodoo}/sql_excel_query.py +40 -18
- pyodoo-0.8.1/pyodoo/transport.py +78 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/v12/__init__.py +9 -5
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyproject.toml +3 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/tests/test_compare_types.py +120 -101
- {pyodoo-0.7.2 → pyodoo-0.8.1}/tests/test_contacts.py +34 -15
- {pyodoo-0.7.2 → pyodoo-0.8.1}/tests/test_python_code.py +59 -27
- {pyodoo-0.7.2 → pyodoo-0.8.1}/tests/test_sql_excel_query.py +92 -38
- {pyodoo-0.7.2 → pyodoo-0.8.1}/LICENSE +0 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PyOdoo.egg-info/dependency_links.txt +0 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PyOdoo.egg-info/requires.txt +0 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/PyOdoo.egg-info/top_level.txt +0 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/pyodoo/samples/__init__.py +0 -0
- {pyodoo-0.7.2 → pyodoo-0.8.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyOdoo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: API for Odoo
|
|
5
5
|
Author-email: Fabio Castelli <muflone@muflone.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -12,10 +12,13 @@ Classifier: Development Status :: 1 - Planning
|
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Requires-Python: >=3.9
|
|
19
22
|
Description-Content-Type: text/markdown
|
|
20
23
|
License-File: LICENSE
|
|
21
24
|
Requires-Dist: xlrd~=2.0
|
|
@@ -24,19 +27,19 @@ Dynamic: license-file
|
|
|
24
27
|
|
|
25
28
|
# PyOdoo
|
|
26
29
|
|
|
27
|
-
[](https://www.travis-ci.com/github/muflone/pyodoo)
|
|
28
30
|
[](https://circleci.com/gh/muflone/pyodoo)
|
|
29
31
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.9.yml)
|
|
30
32
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.10.yml)
|
|
31
33
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.11.yml)
|
|
32
34
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.12.yml)
|
|
33
35
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.13.yml)
|
|
36
|
+
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.14.yml)
|
|
34
37
|
[](https://pypi.org/project/PyOdoo/)
|
|
35
38
|
[](https://pypi.org/project/PyOdoo/)
|
|
36
39
|
|
|
37
40
|
**Description:** API for Odoo
|
|
38
41
|
|
|
39
|
-
**Copyright:** 2021-
|
|
42
|
+
**Copyright:** 2021-2026 Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
40
43
|
|
|
41
44
|
**License:** GPL-3+
|
|
42
45
|
|
|
@@ -48,7 +51,11 @@ Dynamic: license-file
|
|
|
48
51
|
|
|
49
52
|
PyOdoo is an attempt to build a common API to interact with any
|
|
50
53
|
[**Odoo**](https://www.odoo.com/) server in order to operate using
|
|
51
|
-
its
|
|
54
|
+
its APIs.
|
|
55
|
+
|
|
56
|
+
Currently the following implementations are provided:
|
|
57
|
+
- XML-RPC
|
|
58
|
+
- JSON-RPC
|
|
52
59
|
|
|
53
60
|
# System Requirements
|
|
54
61
|
|
|
@@ -59,3 +66,5 @@ its XML RPC API.
|
|
|
59
66
|
# Usage
|
|
60
67
|
|
|
61
68
|
Please see the **samples** and the **tests** folders for some usage examples.
|
|
69
|
+
|
|
70
|
+
Examples and documentation is available at <http://www.muflone.com/pyodoo/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyOdoo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: API for Odoo
|
|
5
5
|
Author-email: Fabio Castelli <muflone@muflone.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -12,10 +12,13 @@ Classifier: Development Status :: 1 - Planning
|
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Requires-Python: >=3.9
|
|
19
22
|
Description-Content-Type: text/markdown
|
|
20
23
|
License-File: LICENSE
|
|
21
24
|
Requires-Dist: xlrd~=2.0
|
|
@@ -24,19 +27,19 @@ Dynamic: license-file
|
|
|
24
27
|
|
|
25
28
|
# PyOdoo
|
|
26
29
|
|
|
27
|
-
[](https://www.travis-ci.com/github/muflone/pyodoo)
|
|
28
30
|
[](https://circleci.com/gh/muflone/pyodoo)
|
|
29
31
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.9.yml)
|
|
30
32
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.10.yml)
|
|
31
33
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.11.yml)
|
|
32
34
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.12.yml)
|
|
33
35
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.13.yml)
|
|
36
|
+
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.14.yml)
|
|
34
37
|
[](https://pypi.org/project/PyOdoo/)
|
|
35
38
|
[](https://pypi.org/project/PyOdoo/)
|
|
36
39
|
|
|
37
40
|
**Description:** API for Odoo
|
|
38
41
|
|
|
39
|
-
**Copyright:** 2021-
|
|
42
|
+
**Copyright:** 2021-2026 Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
40
43
|
|
|
41
44
|
**License:** GPL-3+
|
|
42
45
|
|
|
@@ -48,7 +51,11 @@ Dynamic: license-file
|
|
|
48
51
|
|
|
49
52
|
PyOdoo is an attempt to build a common API to interact with any
|
|
50
53
|
[**Odoo**](https://www.odoo.com/) server in order to operate using
|
|
51
|
-
its
|
|
54
|
+
its APIs.
|
|
55
|
+
|
|
56
|
+
Currently the following implementations are provided:
|
|
57
|
+
- XML-RPC
|
|
58
|
+
- JSON-RPC
|
|
52
59
|
|
|
53
60
|
# System Requirements
|
|
54
61
|
|
|
@@ -59,3 +66,5 @@ its XML RPC API.
|
|
|
59
66
|
# Usage
|
|
60
67
|
|
|
61
68
|
Please see the **samples** and the **tests** folders for some usage examples.
|
|
69
|
+
|
|
70
|
+
Examples and documentation is available at <http://www.muflone.com/pyodoo/>
|
|
@@ -8,11 +8,17 @@ PyOdoo.egg-info/requires.txt
|
|
|
8
8
|
PyOdoo.egg-info/top_level.txt
|
|
9
9
|
pyodoo/__init__.py
|
|
10
10
|
pyodoo/active_status_choice.py
|
|
11
|
+
pyodoo/api.py
|
|
11
12
|
pyodoo/boolean_operator.py
|
|
12
13
|
pyodoo/compare_type.py
|
|
13
14
|
pyodoo/constants.py
|
|
14
15
|
pyodoo/filter.py
|
|
16
|
+
pyodoo/implementation.py
|
|
15
17
|
pyodoo/message_subtype.py
|
|
18
|
+
pyodoo/model.py
|
|
19
|
+
pyodoo/python_code.py
|
|
20
|
+
pyodoo/sql_excel_query.py
|
|
21
|
+
pyodoo/transport.py
|
|
16
22
|
pyodoo/samples/__init__.py
|
|
17
23
|
pyodoo/samples/awaitable.py
|
|
18
24
|
pyodoo/samples/contacts.py
|
|
@@ -20,10 +26,6 @@ pyodoo/samples/contacts_async.py
|
|
|
20
26
|
pyodoo/samples/python_code.py
|
|
21
27
|
pyodoo/samples/sql_excel_query.py
|
|
22
28
|
pyodoo/v12/__init__.py
|
|
23
|
-
pyodoo/v12/api.py
|
|
24
|
-
pyodoo/v12/model.py
|
|
25
|
-
pyodoo/v12/python_code.py
|
|
26
|
-
pyodoo/v12/sql_excel_query.py
|
|
27
29
|
tests/test_compare_types.py
|
|
28
30
|
tests/test_contacts.py
|
|
29
31
|
tests/test_python_code.py
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# PyOdoo
|
|
2
2
|
|
|
3
|
-
[](https://www.travis-ci.com/github/muflone/pyodoo)
|
|
4
3
|
[](https://circleci.com/gh/muflone/pyodoo)
|
|
5
4
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.9.yml)
|
|
6
5
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.10.yml)
|
|
7
6
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.11.yml)
|
|
8
7
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.12.yml)
|
|
9
8
|
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.13.yml)
|
|
9
|
+
[](https://github.com/muflone/pyodoo/actions/workflows/python-3.14.yml)
|
|
10
10
|
[](https://pypi.org/project/PyOdoo/)
|
|
11
11
|
[](https://pypi.org/project/PyOdoo/)
|
|
12
12
|
|
|
13
13
|
**Description:** API for Odoo
|
|
14
14
|
|
|
15
|
-
**Copyright:** 2021-
|
|
15
|
+
**Copyright:** 2021-2026 Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
16
16
|
|
|
17
17
|
**License:** GPL-3+
|
|
18
18
|
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
|
|
25
25
|
PyOdoo is an attempt to build a common API to interact with any
|
|
26
26
|
[**Odoo**](https://www.odoo.com/) server in order to operate using
|
|
27
|
-
its
|
|
27
|
+
its APIs.
|
|
28
|
+
|
|
29
|
+
Currently the following implementations are provided:
|
|
30
|
+
- XML-RPC
|
|
31
|
+
- JSON-RPC
|
|
28
32
|
|
|
29
33
|
# System Requirements
|
|
30
34
|
|
|
@@ -35,3 +39,5 @@ its XML RPC API.
|
|
|
35
39
|
# Usage
|
|
36
40
|
|
|
37
41
|
Please see the **samples** and the **tests** folders for some usage examples.
|
|
42
|
+
|
|
43
|
+
Examples and documentation is available at <http://www.muflone.com/pyodoo/>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -19,8 +19,13 @@
|
|
|
19
19
|
##
|
|
20
20
|
|
|
21
21
|
from .active_status_choice import ActiveStatusChoice # noqa: F401
|
|
22
|
+
from .api import Api # noqa: F401
|
|
22
23
|
from .boolean_operator import BooleanOperator # noqa: F401
|
|
23
24
|
from .compare_type import CompareType # noqa: F401
|
|
24
25
|
from .constants import APP_VERSION as __version__ # noqa: F401
|
|
25
26
|
from .filter import Filter # noqa: F401
|
|
27
|
+
from .implementation import Implementation # noqa: F401
|
|
26
28
|
from .message_subtype import MessageSubType # noqa: F401
|
|
29
|
+
from .model import Model # noqa: F401
|
|
30
|
+
from .python_code import PythonCode # noqa: F401
|
|
31
|
+
from .sql_excel_query import SqlExcelQuery # noqa: F401
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -19,14 +19,21 @@
|
|
|
19
19
|
##
|
|
20
20
|
|
|
21
21
|
from typing import Any, Optional, Union
|
|
22
|
+
import urllib.parse
|
|
22
23
|
from xmlrpc.client import ServerProxy
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
import requests
|
|
26
|
+
import requests.auth
|
|
27
|
+
|
|
28
|
+
from .boolean_operator import BooleanOperator
|
|
29
|
+
from .filter import Filter
|
|
30
|
+
from .implementation import Implementation
|
|
31
|
+
from .transport import TimeoutHttpTransport, TimeoutHttpsTransport
|
|
25
32
|
|
|
26
33
|
|
|
27
34
|
class Api(object):
|
|
28
35
|
"""
|
|
29
|
-
Odoo
|
|
36
|
+
Odoo base API
|
|
30
37
|
"""
|
|
31
38
|
def __init__(self,
|
|
32
39
|
model_name: str,
|
|
@@ -34,7 +41,8 @@ class Api(object):
|
|
|
34
41
|
database: str,
|
|
35
42
|
username: str,
|
|
36
43
|
password: str,
|
|
37
|
-
language: str = None
|
|
44
|
+
language: str = None,
|
|
45
|
+
implementation: Implementation = Implementation.XMLRPC
|
|
38
46
|
) -> None:
|
|
39
47
|
# Associate model
|
|
40
48
|
if not model_name:
|
|
@@ -46,9 +54,14 @@ class Api(object):
|
|
|
46
54
|
self.password = password
|
|
47
55
|
self.language = language
|
|
48
56
|
self.uid = None
|
|
57
|
+
self.implementation = implementation
|
|
58
|
+
self.timeout = None
|
|
49
59
|
# Remove trailing / from endpoint
|
|
50
60
|
if self.endpoint.endswith('/'):
|
|
51
61
|
self.endpoint = self.endpoint[:-1]
|
|
62
|
+
# Specific implementations
|
|
63
|
+
if implementation == Implementation.JSONRPC:
|
|
64
|
+
self.session = requests.Session()
|
|
52
65
|
|
|
53
66
|
def authenticate(self
|
|
54
67
|
) -> int:
|
|
@@ -57,11 +70,37 @@ class Api(object):
|
|
|
57
70
|
|
|
58
71
|
:return: The user ID for the authenticated user
|
|
59
72
|
"""
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
if self.implementation == Implementation.XMLRPC:
|
|
74
|
+
# Authentication for XML-RPC
|
|
75
|
+
proxy = self.get_proxy(method='xmlrpc/2/common')
|
|
76
|
+
self.uid = proxy.authenticate(self.database,
|
|
77
|
+
self.username,
|
|
78
|
+
self.password,
|
|
79
|
+
{})
|
|
80
|
+
elif self.implementation == Implementation.JSONRPC:
|
|
81
|
+
# Authentication for JSON-RPC
|
|
82
|
+
response = self.session.post(
|
|
83
|
+
url=self.build_endpoint(method='jsonrpc'),
|
|
84
|
+
json={
|
|
85
|
+
'jsonrpc': '2.0',
|
|
86
|
+
'method': 'call',
|
|
87
|
+
'params': {
|
|
88
|
+
'service': 'common',
|
|
89
|
+
'method': 'authenticate',
|
|
90
|
+
'args': [
|
|
91
|
+
self.database,
|
|
92
|
+
self.username,
|
|
93
|
+
self.password,
|
|
94
|
+
{}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
timeout=self.timeout)
|
|
99
|
+
result = response.json() if response else None
|
|
100
|
+
self.uid = result['result'] if result else None
|
|
101
|
+
else:
|
|
102
|
+
# Invalid implementation
|
|
103
|
+
raise ValueError(f'Invalid implementation {self.implementation}')
|
|
65
104
|
return self.uid
|
|
66
105
|
|
|
67
106
|
def build_endpoint(self,
|
|
@@ -85,7 +124,22 @@ class Api(object):
|
|
|
85
124
|
:param method: The name of the method to execute
|
|
86
125
|
:return: A new ServerProxy object
|
|
87
126
|
"""
|
|
88
|
-
|
|
127
|
+
url = self.build_endpoint(method=method)
|
|
128
|
+
scheme = urllib.parse.urlparse(url=url).scheme.lower()
|
|
129
|
+
if self.timeout is not None and scheme == 'https':
|
|
130
|
+
# Return a ServerProxy object using TimeoutHttpsTransport
|
|
131
|
+
result = ServerProxy(
|
|
132
|
+
uri=url,
|
|
133
|
+
transport=TimeoutHttpsTransport(timeout=self.timeout))
|
|
134
|
+
elif self.timeout is not None and scheme == 'http':
|
|
135
|
+
# Return a ServerProxy object using TimeoutHttpTransport
|
|
136
|
+
result = ServerProxy(
|
|
137
|
+
uri=url,
|
|
138
|
+
transport=TimeoutHttpTransport(timeout=self.timeout))
|
|
139
|
+
else:
|
|
140
|
+
# Return the standard ServerProxy object without any transport
|
|
141
|
+
result = ServerProxy(uri=url)
|
|
142
|
+
return result
|
|
89
143
|
|
|
90
144
|
def get_proxy_object(self
|
|
91
145
|
) -> ServerProxy:
|
|
@@ -122,14 +176,42 @@ class Api(object):
|
|
|
122
176
|
:param kwargs: arguments dict passed by keyword
|
|
123
177
|
:return:
|
|
124
178
|
"""
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
179
|
+
if self.implementation == Implementation.XMLRPC:
|
|
180
|
+
# Execute for XML-RPC
|
|
181
|
+
proxy = self.get_proxy_object()
|
|
182
|
+
results = proxy.execute_kw(self.database,
|
|
183
|
+
self.uid,
|
|
184
|
+
self.password,
|
|
185
|
+
self.model_name,
|
|
186
|
+
method_name,
|
|
187
|
+
args,
|
|
188
|
+
kwargs)
|
|
189
|
+
elif self.implementation == Implementation.JSONRPC:
|
|
190
|
+
# Execute for JSON-RPC
|
|
191
|
+
results = self.session.post(
|
|
192
|
+
url=self.build_endpoint(method='jsonrpc'),
|
|
193
|
+
json={
|
|
194
|
+
'jsonrpc': '2.0',
|
|
195
|
+
'method': 'call',
|
|
196
|
+
'params': {
|
|
197
|
+
'service': 'object',
|
|
198
|
+
'method': 'execute_kw',
|
|
199
|
+
'args': [
|
|
200
|
+
self.database,
|
|
201
|
+
self.uid,
|
|
202
|
+
self.password,
|
|
203
|
+
self.model_name,
|
|
204
|
+
method_name,
|
|
205
|
+
args,
|
|
206
|
+
kwargs
|
|
207
|
+
],
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
timeout=self.timeout
|
|
211
|
+
).json().get('result')
|
|
212
|
+
else:
|
|
213
|
+
# Invalid implementation
|
|
214
|
+
raise ValueError(f'Invalid implementation {self.implementation}')
|
|
133
215
|
return results
|
|
134
216
|
|
|
135
217
|
def do_read(self,
|
|
@@ -309,3 +391,13 @@ class Api(object):
|
|
|
309
391
|
return self.do_execute(method_name='message_post',
|
|
310
392
|
args=[entity_id],
|
|
311
393
|
kwargs=kwargs)
|
|
394
|
+
|
|
395
|
+
def set_timeout(self,
|
|
396
|
+
timeout: Optional[float]) -> None:
|
|
397
|
+
"""
|
|
398
|
+
Set the connection and transfer timeout
|
|
399
|
+
|
|
400
|
+
:param timeout: allowed time for connection and transfer in seconds
|
|
401
|
+
:return: None
|
|
402
|
+
"""
|
|
403
|
+
self.timeout = timeout
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
##
|
|
20
20
|
|
|
21
21
|
APP_NAME = 'PyOdoo'
|
|
22
|
-
APP_VERSION = '0.
|
|
22
|
+
APP_VERSION = '0.8.1'
|
|
23
23
|
APP_DESCRIPTION = 'API for Odoo'
|
|
24
24
|
APP_DOMAIN = 'pyodoo'
|
|
25
25
|
APP_ID = f'{APP_DOMAIN}.muflone.com'
|
|
26
26
|
APP_AUTHOR = 'Fabio Castelli'
|
|
27
27
|
APP_AUTHOR_EMAIL = 'muflone@muflone.com'
|
|
28
|
-
APP_COPYRIGHT = f'Copyright 2021-
|
|
28
|
+
APP_COPYRIGHT = f'Copyright 2021-2026 {APP_AUTHOR}'
|
|
29
29
|
URL_AUTHOR = 'http://www.muflone.com/'
|
|
30
30
|
URL_APPLICATION = f'{URL_AUTHOR}{APP_DOMAIN}/'
|
|
31
31
|
URL_SOURCES = f'https://github.com/muflone/{APP_DOMAIN}/'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
from typing import Union
|
|
22
22
|
|
|
23
|
-
from
|
|
23
|
+
from .compare_type import CompareType
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class Filter(object):
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
##
|
|
2
|
+
# Project: PyOdoo
|
|
3
|
+
# Description: API for Odoo
|
|
4
|
+
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
|
+
# License: GPL-3+
|
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
# (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License
|
|
18
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
##
|
|
20
|
+
|
|
21
|
+
class Implementation(object):
|
|
22
|
+
"""
|
|
23
|
+
Implementations used in Odoo API
|
|
24
|
+
"""
|
|
25
|
+
XMLRPC = 'xmlrpc'
|
|
26
|
+
JSONRPC = 'jsonrpc'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Project: PyOdoo
|
|
3
3
|
# Description: API for Odoo
|
|
4
4
|
# Author: Fabio Castelli (Muflone) <muflone@muflone.com>
|
|
5
|
-
# Copyright: 2021-
|
|
5
|
+
# Copyright: 2021-2026 Fabio Castelli
|
|
6
6
|
# License: GPL-3+
|
|
7
7
|
# This program is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|