Index Page
This site contains the project documentation for the
odooaiorpc
project.
Table Of Contents
The documentation follows the best practice for project documentation as described by Daniele Procida in the Diátaxis documentation framework and consists of four separate parts:
Quickly find what you're looking for depending on your use case by looking at the different pages.
Project Overview
OdooAioRPC is an aync Odoo remote procedure call
OdooAioRPC
Source code in odooaiorpc/client.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
common: CommonDomain
property
Return common RPC domain Initialize if not already done
Returns:
Name | Type | Description |
---|---|---|
CommonDomain |
CommonDomain
|
Common RPC domain |
db: DBDomain
property
Return db RPC domain Initialize if not already done
Returns:
Name | Type | Description |
---|---|---|
DBDomain |
DBDomain
|
DB RPC domain |
is_auth: bool
property
Check if auth has been done
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
auth state |
models: ModelDomain
property
Return object/models RPC domain Initialize if not already done
Returns:
Name | Type | Description |
---|---|---|
ModelDomain |
ModelDomain
|
Object RPC domain |
__init__(url, database, user, secret, protocol=const.Protocol.jsonrpc, auth=None, headers=None, context=None, timeout=5.0, transport=None)
Initialize OdooAioRPC client
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
t.Union[str, AnyUrl]
|
Odoo http URL |
required |
database |
str
|
Odoo database |
required |
user |
str
|
Odoo user to connect with |
required |
secret |
str
|
Odoo user generated api key or password (discouraged) |
required |
protocol |
const.Protocol
|
Communication protocol. Defaults to const.Protocol.jsonrpc. |
const.Protocol.jsonrpc
|
auth |
t.Optional[AuthTypes]
|
Auth options. Defaults to None. |
None
|
headers |
t.Optional[HeaderTypes]
|
Custom http headers. Defaults to None. |
None
|
context |
t.Optional[VerifyTypes]
|
SSL context. Defaults to None. |
None
|
timeout |
TimeoutTypes
|
Connection timeout. Defaults to 5.0. |
5.0
|
transport |
t.Optional[BaseProtocol]
|
description. Defaults to None. |
None
|
Source code in odooaiorpc/client.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
authenticate()
async
Authenticate configured user with Odoo Return uid if auth process success
Returns:
Type | Description |
---|---|
t.Optional[int]
|
t.Optional[int]: User uid |
Source code in odooaiorpc/client.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
from_settings(settings)
classmethod
Initialize OdooAioRPC client from OdooSettings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
OdooSettings
|
settings |
required |
Returns:
Name | Type | Description |
---|---|---|
OdooAioRPC |
OdooAioRPC
|
RPC client instance |
Source code in odooaiorpc/client.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
get_protocol_from_settings(settings)
staticmethod
Get configured protocol class from OdooSettings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
OdooSettings
|
settings to get config from |
required |
Returns:
Name | Type | Description |
---|---|---|
BaseProtocol |
BaseProtocol
|
Protocol instance |
Source code in odooaiorpc/client.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
version()
async
Return Odoo server version informations
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Version infos |
Source code in odooaiorpc/client.py
114 115 116 117 118 119 120 121 |
|
OdooSettings
Bases: BaseSettings
Odoo client configuration settings
Source code in odooaiorpc/config.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
database: t.Optional[str] = None
class-attribute
instance-attribute
Odoo database
protocol: const.Protocol = const.Protocol.jsonrpc
class-attribute
instance-attribute
RPC protocol used to communicate. Default to jsonrpc
secret: str
instance-attribute
Odoo user API key
url: AnyUrl
instance-attribute
Odoo url
user: str
instance-attribute
Odoo user
extract_db_name(v, values, **kwargs)
Extract database name from url if not specified
Source code in odooaiorpc/config.py
45 46 47 48 49 50 51 52 53 |
|