robotframework-odoofx 0.1.0__py3-none-any.whl
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.
- OdooFxLibrary/__init__.py +15 -0
- OdooFxLibrary/odoo_library.py +484 -0
- OdooFxLibrary/rpc.py +329 -0
- robotframework_odoofx-0.1.0.dist-info/METADATA +139 -0
- robotframework_odoofx-0.1.0.dist-info/RECORD +9 -0
- robotframework_odoofx-0.1.0.dist-info/WHEEL +5 -0
- robotframework_odoofx-0.1.0.dist-info/licenses/LICENSE +134 -0
- robotframework_odoofx-0.1.0.dist-info/licenses/NOTICE +43 -0
- robotframework_odoofx-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ODOOFX - Odoo test automation for Robot Framework.
|
|
3
|
+
|
|
4
|
+
ORM, RPC/XML-RPC, UI web (Playwright), workflows.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__author__ = "Cyril Montiel"
|
|
9
|
+
__email__ = "cyril@montiel.me"
|
|
10
|
+
__license__ = "Apache-2.0"
|
|
11
|
+
|
|
12
|
+
# Core library exports will go here
|
|
13
|
+
from .odoo_library import OdooFxLibrary
|
|
14
|
+
|
|
15
|
+
__all__ = ["OdooFxLibrary", "__version__"]
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OdooFxLibrary : Core Robot Framework library for Odoo test automation.
|
|
3
|
+
|
|
4
|
+
Provides keywords for:
|
|
5
|
+
- Web UI automation (Browser/Playwright), not implemented yet
|
|
6
|
+
- RPC access to the Odoo backend (XML-RPC up to Odoo 18, JSON-2 from Odoo 19)
|
|
7
|
+
- ORM reads: counts, records, selection values, record states
|
|
8
|
+
|
|
9
|
+
Version: 0.1.0 (bootstrap phase)
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import uuid
|
|
13
|
+
from datetime import datetime, timezone
|
|
14
|
+
from typing import Any, Callable, Optional, Union
|
|
15
|
+
|
|
16
|
+
from robot.api import logger
|
|
17
|
+
from robot.api.deco import keyword, library
|
|
18
|
+
from robot.api.types import Secret
|
|
19
|
+
|
|
20
|
+
from .rpc import (
|
|
21
|
+
OdooRpcError, choose_channel, detect_version, open_channel, series_of, server_time,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
QUOTATION_MODEL = "sale.order"
|
|
25
|
+
GROUPS_RENAMED_SERIES = 19
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _reveal(secret: Union[Secret, str]) -> str:
|
|
29
|
+
return secret.value if isinstance(secret, Secret) else str(secret)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@library
|
|
33
|
+
class OdooFxLibrary:
|
|
34
|
+
"""Odoo test automation library for Robot Framework.
|
|
35
|
+
|
|
36
|
+
*Connection.* `Connect To Odoo` proves the target (URL, database, version)
|
|
37
|
+
before any other keyword works. The channel follows the server version:
|
|
38
|
+
JSON-2 with an API key from Odoo 19, XML-RPC with a password before. On
|
|
39
|
+
Odoo 19 a password only works with ``channel=xmlrpc``, which Odoo 19
|
|
40
|
+
deprecates (removal announced for Odoo 22).
|
|
41
|
+
|
|
42
|
+
*Secrets.* Pass the password or API key as a Robot Framework ``Secret``
|
|
43
|
+
variable (``-v PASSWORD:Secret:...``) or an environment variable, never a
|
|
44
|
+
literal in a suite. The library never logs it nor returns it.
|
|
45
|
+
|
|
46
|
+
*States.* Assertions compare technical state codes (``draft``, ``sale``),
|
|
47
|
+
never translated labels.
|
|
48
|
+
|
|
49
|
+
*Writes.* Off by default: `Create Odoo Record`, `Update Odoo Record`,
|
|
50
|
+
`Delete Odoo Record` and `Call Odoo Record Method` refuse to run unless the
|
|
51
|
+
connection was opened with ``allow_write=${TRUE}``. Pair it with
|
|
52
|
+
``expected_series`` so a suite aimed at one Odoo version refuses to write
|
|
53
|
+
to another. Every write is journaled (`Get Odoo Write Journal`): ``planned``
|
|
54
|
+
before the call, then ``done``, ``failed`` or ``unknown`` (the request may
|
|
55
|
+
have reached the server without an answer: read the record to find out,
|
|
56
|
+
never send it again). Mark what a run creates with `New Odoo Run Marker` so
|
|
57
|
+
it can be found again and removed; `Odoo Record Should Not Exist` proves a
|
|
58
|
+
removal on the identified record.
|
|
59
|
+
|
|
60
|
+
`Navigate To Menu` and `Create New Quotation` are still skeletons that do
|
|
61
|
+
nothing but warn, so a suite that calls them proves nothing about them.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
ROBOT_LIBRARY_SCOPE = "GLOBAL"
|
|
65
|
+
ROBOT_LIBRARY_VERSION = "0.1.0"
|
|
66
|
+
|
|
67
|
+
def __init__(self):
|
|
68
|
+
self._channel = None
|
|
69
|
+
self._info = None
|
|
70
|
+
self._journal = []
|
|
71
|
+
|
|
72
|
+
def _require_channel(self):
|
|
73
|
+
if self._channel is None:
|
|
74
|
+
raise OdooRpcError("Not connected: call Connect To Odoo first")
|
|
75
|
+
return self._channel
|
|
76
|
+
|
|
77
|
+
def _require_channel_info(self) -> dict:
|
|
78
|
+
self._require_channel()
|
|
79
|
+
return self._info
|
|
80
|
+
|
|
81
|
+
@keyword("Connect To Odoo")
|
|
82
|
+
def connect_to_odoo(self, url: str, database: str, login: str,
|
|
83
|
+
password: Union[Secret, str], channel: str = "auto",
|
|
84
|
+
allow_write: bool = False,
|
|
85
|
+
expected_series: Optional[int] = None) -> dict:
|
|
86
|
+
"""Connect to an Odoo instance and prove the target.
|
|
87
|
+
|
|
88
|
+
``channel`` is ``auto`` (JSON-2 from Odoo 19, XML-RPC before),
|
|
89
|
+
``xmlrpc`` or ``json2``. With JSON-2, ``password`` is the API key and
|
|
90
|
+
``login`` is not used. ``allow_write`` opts in to the write keywords.
|
|
91
|
+
``expected_series`` (16, 19...) makes the connection fail, before any
|
|
92
|
+
login, when the server runs another major version. Returns the
|
|
93
|
+
connection info (url, database, server_version, series, channel, uid,
|
|
94
|
+
allow_write), never the secret.
|
|
95
|
+
"""
|
|
96
|
+
secret = _reveal(password)
|
|
97
|
+
if not secret:
|
|
98
|
+
raise OdooRpcError("Empty password or API key")
|
|
99
|
+
if not database:
|
|
100
|
+
raise OdooRpcError("The database must be named explicitly")
|
|
101
|
+
base = url.rstrip("/")
|
|
102
|
+
server_version = detect_version(base)
|
|
103
|
+
series = series_of(server_version)
|
|
104
|
+
if expected_series is not None and series != expected_series:
|
|
105
|
+
raise OdooRpcError(
|
|
106
|
+
f"Wrong target: {base} runs Odoo {server_version}, expected series {expected_series}")
|
|
107
|
+
chosen = choose_channel(channel, series)
|
|
108
|
+
self.disconnect_from_odoo()
|
|
109
|
+
try:
|
|
110
|
+
self._channel = open_channel(base, database, login, secret, chosen)
|
|
111
|
+
except OdooRpcError as exc:
|
|
112
|
+
if channel == "auto" and chosen == "json2":
|
|
113
|
+
raise OdooRpcError(f"{exc}. channel=auto chose JSON-2, which needs an API key "
|
|
114
|
+
"as the password; pass channel=xmlrpc to use a password") from None
|
|
115
|
+
raise
|
|
116
|
+
self._info = {
|
|
117
|
+
"url": base,
|
|
118
|
+
"database": database,
|
|
119
|
+
"server_version": server_version,
|
|
120
|
+
"series": series,
|
|
121
|
+
"channel": chosen,
|
|
122
|
+
"uid": self._channel.uid,
|
|
123
|
+
"allow_write": bool(allow_write),
|
|
124
|
+
}
|
|
125
|
+
logger.info(f"Connected to {base} database {database}: Odoo {server_version}, "
|
|
126
|
+
f"channel {chosen}, uid {self._channel.uid}, writes "
|
|
127
|
+
f"{'allowed' if allow_write else 'off'}")
|
|
128
|
+
return dict(self._info)
|
|
129
|
+
|
|
130
|
+
@keyword("Get Odoo Connection Info")
|
|
131
|
+
def get_odoo_connection_info(self) -> dict:
|
|
132
|
+
"""Return the proven target of the current connection (no secret)."""
|
|
133
|
+
self._require_channel()
|
|
134
|
+
return dict(self._info)
|
|
135
|
+
|
|
136
|
+
@keyword("Count Odoo Records")
|
|
137
|
+
def count_odoo_records(self, model: str, domain: Optional[list] = None,
|
|
138
|
+
context: Optional[dict] = None) -> int:
|
|
139
|
+
"""Count the records of ``model`` matching ``domain`` (all when empty).
|
|
140
|
+
|
|
141
|
+
``context`` is the call's context, for instance ``${{{"lang": "en_US"}}}``
|
|
142
|
+
or ``${{{"active_test": False}}}`` to count archived records too.
|
|
143
|
+
|
|
144
|
+
A count proves a target's demo data. To prove a presence or a
|
|
145
|
+
disappearance, read the identified record instead of comparing counts.
|
|
146
|
+
"""
|
|
147
|
+
return self._require_channel().search_count(model, domain or [], context=context)
|
|
148
|
+
|
|
149
|
+
@keyword("Search Read Odoo Records")
|
|
150
|
+
def search_read_odoo_records(self, model: str, domain: Optional[list] = None,
|
|
151
|
+
fields: Optional[list] = None, limit: int = 0,
|
|
152
|
+
order: str = "", context: Optional[dict] = None) -> list:
|
|
153
|
+
"""Return the records of ``model`` matching ``domain`` as a list of dicts.
|
|
154
|
+
|
|
155
|
+
``context`` is the call's context (``lang``, ``active_test``...)."""
|
|
156
|
+
return self._require_channel().search_read(
|
|
157
|
+
model, domain or [], fields=fields, limit=limit, order=order, context=context)
|
|
158
|
+
|
|
159
|
+
@keyword("Get Odoo Server Time")
|
|
160
|
+
def get_odoo_server_time(self) -> str:
|
|
161
|
+
"""Return the server's clock as an Odoo datetime string (UTC, one second).
|
|
162
|
+
|
|
163
|
+
Read from the HTTP ``Date`` header: the only clock a client can trust to
|
|
164
|
+
bracket what a run created, for instance ``[["create_date", ">=", t0]]``.
|
|
165
|
+
"""
|
|
166
|
+
return server_time(self._require_channel_info()["url"])
|
|
167
|
+
|
|
168
|
+
@keyword("Get Field Selection Values")
|
|
169
|
+
def get_field_selection_values(self, model: str, field: str) -> list:
|
|
170
|
+
"""Return the technical codes of a selection field, in declaration order."""
|
|
171
|
+
definition = self._require_channel().fields_get(
|
|
172
|
+
model, ["type", "selection"]).get(field)
|
|
173
|
+
if definition is None:
|
|
174
|
+
raise OdooRpcError(f"{model} has no field {field!r}")
|
|
175
|
+
if definition.get("type") != "selection":
|
|
176
|
+
raise OdooRpcError(f"{model}.{field} is a {definition.get('type')} field, not a selection")
|
|
177
|
+
return [code for code, _label in definition["selection"]]
|
|
178
|
+
|
|
179
|
+
@keyword("Count Odoo Records By State")
|
|
180
|
+
def count_odoo_records_by_state(self, model: str, state_field: str = "state") -> dict:
|
|
181
|
+
"""Return ``{state code: record count}`` for every code of ``state_field``."""
|
|
182
|
+
return {code: self.count_odoo_records(model, [[state_field, "=", code]])
|
|
183
|
+
for code in self.get_field_selection_values(model, state_field)}
|
|
184
|
+
|
|
185
|
+
@keyword("Get Odoo Record State")
|
|
186
|
+
def get_odoo_record_state(self, model: str, record: Union[int, list],
|
|
187
|
+
state_field: str = "state",
|
|
188
|
+
context: Optional[dict] = None) -> str:
|
|
189
|
+
"""Return the state code of one identified record.
|
|
190
|
+
|
|
191
|
+
``record`` is a database id or a domain that must match exactly one
|
|
192
|
+
record: anything else fails, so a state is never read off a guess.
|
|
193
|
+
``context`` is the call's context (``active_test``...).
|
|
194
|
+
"""
|
|
195
|
+
domain = [["id", "=", record]] if isinstance(record, int) else record
|
|
196
|
+
found = self._require_channel().search_read(
|
|
197
|
+
model, domain, fields=[state_field], limit=2, context=context)
|
|
198
|
+
if len(found) != 1:
|
|
199
|
+
raise OdooRpcError(
|
|
200
|
+
f"Expected exactly one {model} record for {domain}, found {len(found)}")
|
|
201
|
+
return found[0][state_field]
|
|
202
|
+
|
|
203
|
+
@keyword("Odoo Record State Should Be")
|
|
204
|
+
def odoo_record_state_should_be(self, model: str, record: Union[int, list],
|
|
205
|
+
expected_state: str, state_field: str = "state") -> None:
|
|
206
|
+
"""Fail unless the identified record is in ``expected_state`` (a state code).
|
|
207
|
+
|
|
208
|
+
An ``expected_state`` that is not a code of ``state_field`` fails too,
|
|
209
|
+
so a translated label can never pass by accident.
|
|
210
|
+
"""
|
|
211
|
+
codes = self.get_field_selection_values(model, state_field)
|
|
212
|
+
if expected_state not in codes:
|
|
213
|
+
raise AssertionError(
|
|
214
|
+
f"{expected_state!r} is not a {model}.{state_field} code, expected one of {codes}")
|
|
215
|
+
actual = self.get_odoo_record_state(model, record, state_field)
|
|
216
|
+
if actual != expected_state:
|
|
217
|
+
raise AssertionError(
|
|
218
|
+
f"{model} {record} is in state {actual!r}, expected {expected_state!r}")
|
|
219
|
+
|
|
220
|
+
@keyword("Assert Quotation Status Is")
|
|
221
|
+
def assert_quotation_status_is(self, expected_status: str,
|
|
222
|
+
quotation: Union[int, str, None] = None) -> None:
|
|
223
|
+
"""Assert that a sales quotation is in ``expected_status``, a state code.
|
|
224
|
+
|
|
225
|
+
``expected_status`` is ``draft``, ``sent``, ``sale``, ``done`` or
|
|
226
|
+
``cancel``, never the translated label. ``quotation`` is the order
|
|
227
|
+
reference (``S00042``) or its database id.
|
|
228
|
+
"""
|
|
229
|
+
if quotation is None:
|
|
230
|
+
raise OdooRpcError("No quotation identified: pass quotation=<reference or id>")
|
|
231
|
+
record = quotation if isinstance(quotation, int) else [["name", "=", quotation]]
|
|
232
|
+
self.odoo_record_state_should_be(QUOTATION_MODEL, record, expected_status)
|
|
233
|
+
|
|
234
|
+
@keyword("Resolve Odoo External Id")
|
|
235
|
+
def resolve_odoo_external_id(self, external_id: str, expected_model: str) -> int:
|
|
236
|
+
"""Return the database id behind an external id such as ``product.product_product_1``.
|
|
237
|
+
|
|
238
|
+
Fails unless the identifier names exactly one record of ``expected_model``.
|
|
239
|
+
An external id does not depend on the language of the instance, unlike a
|
|
240
|
+
product name or a menu label."""
|
|
241
|
+
module, separator, name = external_id.partition(".")
|
|
242
|
+
if not (module and separator and name):
|
|
243
|
+
raise OdooRpcError(f"{external_id!r} is not a module.name external id")
|
|
244
|
+
rows = self._require_channel().search_read(
|
|
245
|
+
"ir.model.data", [["module", "=", module], ["name", "=", name]],
|
|
246
|
+
fields=["model", "res_id"])
|
|
247
|
+
if len(rows) != 1:
|
|
248
|
+
raise OdooRpcError(
|
|
249
|
+
f"External id {external_id} is not exactly one record (found {len(rows)})")
|
|
250
|
+
if rows[0]["model"] != expected_model:
|
|
251
|
+
raise OdooRpcError(
|
|
252
|
+
f"External id {external_id} names a {rows[0]['model']}, not a {expected_model}")
|
|
253
|
+
return rows[0]["res_id"]
|
|
254
|
+
|
|
255
|
+
@keyword("Get Odoo Config Parameter")
|
|
256
|
+
def get_odoo_config_parameter(self, key: str) -> str:
|
|
257
|
+
"""Return a system parameter such as ``web.base.url`` (readable by an administrator only).
|
|
258
|
+
|
|
259
|
+
The instance's own base address names the address a suite was pointed at."""
|
|
260
|
+
rows = self._require_channel().search_read(
|
|
261
|
+
"ir.config_parameter", [["key", "=", key]], fields=["value"])
|
|
262
|
+
if len(rows) != 1:
|
|
263
|
+
raise OdooRpcError(f"System parameter {key} is not exactly one record (found {len(rows)})")
|
|
264
|
+
return rows[0]["value"]
|
|
265
|
+
|
|
266
|
+
def _user_in_group(self, user_id: int, group_external_id: str) -> bool:
|
|
267
|
+
group_id = self.resolve_odoo_external_id(group_external_id, "res.groups")
|
|
268
|
+
field = "group_ids" if self._info["series"] >= GROUPS_RENAMED_SERIES else "groups_id"
|
|
269
|
+
return bool(self._require_channel().search_count(
|
|
270
|
+
"res.users", [["id", "=", user_id], [field, "in", [group_id]]]))
|
|
271
|
+
|
|
272
|
+
@keyword("Odoo User Should Be In Group")
|
|
273
|
+
def odoo_user_should_be_in_group(self, user_id: int, group_external_id: str) -> None:
|
|
274
|
+
"""Fail unless the user belongs to the group named by its external id.
|
|
275
|
+
|
|
276
|
+
The field holding a user's groups is named after the server series
|
|
277
|
+
(``groups_id`` before Odoo 19, ``group_ids`` from 19)."""
|
|
278
|
+
if not self._user_in_group(user_id, group_external_id):
|
|
279
|
+
raise AssertionError(f"User {user_id} is not in group {group_external_id}")
|
|
280
|
+
|
|
281
|
+
@keyword("Odoo User Should Not Be In Group")
|
|
282
|
+
def odoo_user_should_not_be_in_group(self, user_id: int, group_external_id: str) -> None:
|
|
283
|
+
"""Fail when the user belongs to the group named by its external id (a precondition)."""
|
|
284
|
+
if self._user_in_group(user_id, group_external_id):
|
|
285
|
+
raise AssertionError(f"User {user_id} is in group {group_external_id}")
|
|
286
|
+
|
|
287
|
+
@keyword("Get Odoo Record")
|
|
288
|
+
def get_odoo_record(self, model: str, record: Union[int, list],
|
|
289
|
+
fields: Optional[list] = None, context: Optional[dict] = None) -> dict:
|
|
290
|
+
"""Return the named ``fields`` (all when empty) of one identified record.
|
|
291
|
+
|
|
292
|
+
``record`` is a database id or a domain that must match exactly one record."""
|
|
293
|
+
domain = [["id", "=", record]] if isinstance(record, int) else record
|
|
294
|
+
found = self._require_channel().search_read(
|
|
295
|
+
model, domain, fields=fields, limit=2, context=context)
|
|
296
|
+
if len(found) != 1:
|
|
297
|
+
raise OdooRpcError(
|
|
298
|
+
f"Expected exactly one {model} record for {domain}, found {len(found)}")
|
|
299
|
+
return found[0]
|
|
300
|
+
|
|
301
|
+
@keyword("Odoo Record Exists")
|
|
302
|
+
def odoo_record_exists(self, model: str, record_id: int) -> bool:
|
|
303
|
+
"""Return whether the record with this database id exists (archived ones count)."""
|
|
304
|
+
return bool(self._record_count(model, record_id))
|
|
305
|
+
|
|
306
|
+
@keyword("Odoo Record Should Exist")
|
|
307
|
+
def odoo_record_should_exist(self, model: str, record_id: int) -> None:
|
|
308
|
+
"""Fail unless the record with this database id exists (archived ones count)."""
|
|
309
|
+
if not self._record_count(model, record_id):
|
|
310
|
+
raise AssertionError(f"{model} {record_id} does not exist")
|
|
311
|
+
|
|
312
|
+
@keyword("Odoo Record Should Not Exist")
|
|
313
|
+
def odoo_record_should_not_exist(self, model: str, record_id: int) -> None:
|
|
314
|
+
"""Fail if the record with this database id still exists (archived ones count).
|
|
315
|
+
|
|
316
|
+
A removal is proven on the identified record, never on a count that
|
|
317
|
+
went back to its previous value."""
|
|
318
|
+
if self._record_count(model, record_id):
|
|
319
|
+
raise AssertionError(f"{model} {record_id} still exists")
|
|
320
|
+
|
|
321
|
+
def _record_count(self, model: str, record_id: int) -> int:
|
|
322
|
+
return self._require_channel().search_count(
|
|
323
|
+
model, [["id", "=", record_id]], context={"active_test": False})
|
|
324
|
+
|
|
325
|
+
@keyword("New Odoo Run Marker")
|
|
326
|
+
def new_odoo_run_marker(self, prefix: str = "ODOOFX") -> str:
|
|
327
|
+
"""Return a unique label such as ``ODOOFX-20260930T203012-9f3a1c``.
|
|
328
|
+
|
|
329
|
+
Put it in a free-text field of every record a run creates, so the run's
|
|
330
|
+
data can be identified, found again and removed."""
|
|
331
|
+
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S")
|
|
332
|
+
return f"{prefix}-{stamp}-{uuid.uuid4().hex[:6]}"
|
|
333
|
+
|
|
334
|
+
def _journaled_write(self, operation: str, model: str, ids: list, fields: list,
|
|
335
|
+
act: Callable[[Any], Any], method: str = "") -> Any:
|
|
336
|
+
channel = self._require_channel()
|
|
337
|
+
if not self._info["allow_write"]:
|
|
338
|
+
raise OdooRpcError(
|
|
339
|
+
f"Writes are off: {operation} on {model} refused, connect with allow_write=${{TRUE}}")
|
|
340
|
+
entry = {"seq": len(self._journal) + 1, "phase": "planned", "operation": operation,
|
|
341
|
+
"database": self._info["database"], "model": model, "method": method,
|
|
342
|
+
"ids": list(ids), "fields": sorted(fields)}
|
|
343
|
+
self._journal.append(entry)
|
|
344
|
+
logger.info(f"write {entry['seq']} planned: {operation} {model} {method} {entry['ids']}")
|
|
345
|
+
try:
|
|
346
|
+
result = act(channel)
|
|
347
|
+
except OdooRpcError as exc:
|
|
348
|
+
entry["phase"] = "unknown" if exc.unknown_outcome else "failed"
|
|
349
|
+
entry["error"] = str(exc)
|
|
350
|
+
logger.info(f"write {entry['seq']} {entry['phase']}: {exc}")
|
|
351
|
+
raise
|
|
352
|
+
except Exception as exc:
|
|
353
|
+
entry["phase"] = "unknown"
|
|
354
|
+
entry["error"] = f"{type(exc).__name__}: {exc}"
|
|
355
|
+
logger.info(f"write {entry['seq']} unknown: {entry['error']}")
|
|
356
|
+
raise
|
|
357
|
+
entry["phase"] = "done"
|
|
358
|
+
logger.info(f"write {entry['seq']} done")
|
|
359
|
+
return result
|
|
360
|
+
|
|
361
|
+
@staticmethod
|
|
362
|
+
def _as_ids(record_id: Union[int, list]) -> list:
|
|
363
|
+
return [record_id] if isinstance(record_id, int) else list(record_id)
|
|
364
|
+
|
|
365
|
+
@keyword("Create Odoo Record")
|
|
366
|
+
def create_odoo_record(self, model: str, values: dict) -> int:
|
|
367
|
+
"""Create one record of ``model`` from ``values`` and return its database id.
|
|
368
|
+
|
|
369
|
+
Needs ``allow_write``. Put a `New Odoo Run Marker` in a free-text field
|
|
370
|
+
so the record can be identified and removed."""
|
|
371
|
+
created = self._journaled_write(
|
|
372
|
+
"create", model, [], list(values),
|
|
373
|
+
lambda channel: channel.create(model, values))
|
|
374
|
+
self._journal[-1]["ids"] = [created]
|
|
375
|
+
return created
|
|
376
|
+
|
|
377
|
+
@keyword("Update Odoo Record")
|
|
378
|
+
def update_odoo_record(self, model: str, record_id: Union[int, list], values: dict) -> bool:
|
|
379
|
+
"""Write ``values`` on the identified record(s). Needs ``allow_write``."""
|
|
380
|
+
ids = self._as_ids(record_id)
|
|
381
|
+
return self._journaled_write(
|
|
382
|
+
"update", model, ids, list(values),
|
|
383
|
+
lambda channel: channel.write(model, ids, values))
|
|
384
|
+
|
|
385
|
+
@keyword("Delete Odoo Record")
|
|
386
|
+
def delete_odoo_record(self, model: str, record_id: Union[int, list]) -> bool:
|
|
387
|
+
"""Delete the identified record(s). Needs ``allow_write``.
|
|
388
|
+
|
|
389
|
+
Odoo refuses what the application itself refuses (a confirmed sales
|
|
390
|
+
order, for instance): the refusal is raised, the record stays, and the
|
|
391
|
+
way back goes through the model's own action (cancel) first."""
|
|
392
|
+
ids = self._as_ids(record_id)
|
|
393
|
+
return self._journaled_write(
|
|
394
|
+
"delete", model, ids, [], lambda channel: channel.unlink(model, ids))
|
|
395
|
+
|
|
396
|
+
@keyword("Call Odoo Record Method")
|
|
397
|
+
def call_odoo_record_method(self, model: str, record_id: Union[int, list],
|
|
398
|
+
method: str, **kwargs) -> Any:
|
|
399
|
+
"""Call a public method of the model on the identified record(s), for instance
|
|
400
|
+
``action_confirm`` or ``action_cancel``. Needs ``allow_write``.
|
|
401
|
+
|
|
402
|
+
Named arguments after ``method`` are passed on to the method, except
|
|
403
|
+
``context``, a dict that becomes the call's context (for instance
|
|
404
|
+
``context=${{{"disable_cancel_warning": True}}}``). Returns what the
|
|
405
|
+
method returns: a method that opens a wizard returns its action and
|
|
406
|
+
does not do the work, check the state afterwards."""
|
|
407
|
+
ids = self._as_ids(record_id)
|
|
408
|
+
context = kwargs.pop("context", None)
|
|
409
|
+
return self._journaled_write(
|
|
410
|
+
"call", model, ids, list(kwargs),
|
|
411
|
+
lambda channel: channel.call(model, method, ids, kwargs, context), method=method)
|
|
412
|
+
|
|
413
|
+
@keyword("Get Odoo Write Journal")
|
|
414
|
+
def get_odoo_write_journal(self, since: int = 0) -> list:
|
|
415
|
+
"""Return the writes of this library instance after entry ``since``, oldest first.
|
|
416
|
+
|
|
417
|
+
Each entry has ``seq``, ``phase`` (``planned``, ``done``, ``failed``,
|
|
418
|
+
``unknown``), ``operation``, ``database``, ``model``, ``method``,
|
|
419
|
+
``ids`` and the field names written, never their values. A ``planned``
|
|
420
|
+
or ``unknown`` entry is reconciled by reading the record, never sent
|
|
421
|
+
again. The journal is that of the whole process: take the last ``seq``
|
|
422
|
+
before a test (``${since}``) to judge only what the test wrote."""
|
|
423
|
+
return [dict(entry) for entry in self._journal if entry["seq"] > since]
|
|
424
|
+
|
|
425
|
+
@keyword("Odoo Write Journal Should Hold No Unknown Outcome")
|
|
426
|
+
def odoo_write_journal_should_hold_no_unknown_outcome(self, since: int = 0) -> None:
|
|
427
|
+
"""Fail when a write after entry ``since`` is ``planned`` or ``unknown``.
|
|
428
|
+
|
|
429
|
+
Those two phases mean a write whose effect is not known: read the record
|
|
430
|
+
instead of trusting the run. ``since`` (the last ``seq`` read before the
|
|
431
|
+
test) keeps an earlier test's entry from failing the ones that follow."""
|
|
432
|
+
doubtful = [entry for entry in self.get_odoo_write_journal(since)
|
|
433
|
+
if entry["phase"] in ("planned", "unknown")]
|
|
434
|
+
if doubtful:
|
|
435
|
+
raise AssertionError(
|
|
436
|
+
"Writes with an unknown effect: " + ", ".join(
|
|
437
|
+
f"#{e['seq']} {e['operation']} {e['model']} {e['phase']}" for e in doubtful))
|
|
438
|
+
|
|
439
|
+
@keyword("Reconcile Odoo Write")
|
|
440
|
+
def reconcile_odoo_write(self, seq: int, reason: str) -> None:
|
|
441
|
+
"""Settle a ``planned`` or ``unknown`` journal entry once the record was read back.
|
|
442
|
+
|
|
443
|
+
``seq`` is the entry's number, ``reason`` says what the reading showed (for
|
|
444
|
+
instance ``state read back as sent``). The entry becomes ``reconciled`` and
|
|
445
|
+
no longer fails `Odoo Write Journal Should Hold No Unknown Outcome`. A write
|
|
446
|
+
is never sent again: the reading IS the reconciliation."""
|
|
447
|
+
entry = next((e for e in self._journal if e["seq"] == seq), None)
|
|
448
|
+
if entry is None:
|
|
449
|
+
raise OdooRpcError(f"No journal entry {seq}")
|
|
450
|
+
if entry["phase"] not in ("planned", "unknown"):
|
|
451
|
+
raise OdooRpcError(
|
|
452
|
+
f"Journal entry {seq} is {entry['phase']}: only a planned or unknown write is reconciled")
|
|
453
|
+
if not reason.strip():
|
|
454
|
+
raise OdooRpcError("A reconciliation states what the reading showed")
|
|
455
|
+
entry["phase"] = "reconciled"
|
|
456
|
+
entry["reconciled"] = reason
|
|
457
|
+
logger.info(f"write {seq} reconciled: {reason}")
|
|
458
|
+
|
|
459
|
+
@keyword("Odoo Last Write Should Be")
|
|
460
|
+
def odoo_last_write_should_be(self, phase: str) -> None:
|
|
461
|
+
"""Fail unless the last journaled write is in ``phase`` (``done``, ``failed``...)."""
|
|
462
|
+
if not self._journal:
|
|
463
|
+
raise AssertionError("The write journal is empty")
|
|
464
|
+
actual = self._journal[-1]["phase"]
|
|
465
|
+
if actual != phase:
|
|
466
|
+
raise AssertionError(f"The last write is {actual!r}, expected {phase!r}")
|
|
467
|
+
|
|
468
|
+
@keyword("Navigate To Menu")
|
|
469
|
+
def navigate_to_menu(self, menu_path: str) -> None:
|
|
470
|
+
"""Skeleton: does nothing but warn. The web channel is not implemented yet."""
|
|
471
|
+
logger.warn(f"Navigate To Menu is a skeleton and did not navigate to: {menu_path}")
|
|
472
|
+
|
|
473
|
+
@keyword("Create New Quotation")
|
|
474
|
+
def create_new_quotation(self) -> None:
|
|
475
|
+
"""Skeleton: creates nothing and returns nothing. The write path is not implemented yet."""
|
|
476
|
+
logger.warn("Create New Quotation is a skeleton and created nothing")
|
|
477
|
+
|
|
478
|
+
@keyword("Disconnect From Odoo")
|
|
479
|
+
def disconnect_from_odoo(self) -> None:
|
|
480
|
+
"""Close the current connection, if any."""
|
|
481
|
+
if self._channel is not None:
|
|
482
|
+
self._channel.close()
|
|
483
|
+
self._channel = None
|
|
484
|
+
self._info = None
|
OdooFxLibrary/rpc.py
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"""RPC channels to an Odoo server: XML-RPC (14 to 18) and JSON-2 (19 and later).
|
|
2
|
+
|
|
3
|
+
Both channels expose the same three read operations, so a keyword never
|
|
4
|
+
depends on the wire protocol. Secrets stay private to the channel objects and
|
|
5
|
+
never appear in an error message or a ``repr``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import re
|
|
11
|
+
import xmlrpc.client
|
|
12
|
+
from collections.abc import Mapping
|
|
13
|
+
from datetime import timezone
|
|
14
|
+
from email.utils import parsedate_to_datetime
|
|
15
|
+
from typing import Any, Optional
|
|
16
|
+
|
|
17
|
+
import requests
|
|
18
|
+
|
|
19
|
+
TIMEOUT = 30
|
|
20
|
+
ERROR_LIMIT = 300
|
|
21
|
+
JSON2_FIRST_SERIES = 19
|
|
22
|
+
GATEWAY_ERRORS = (502, 503, 504)
|
|
23
|
+
NONE_RESULT = "cannot marshal None"
|
|
24
|
+
CHANNELS = ("auto", "xmlrpc", "json2")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class OdooRpcError(RuntimeError):
|
|
28
|
+
"""A failure talking to Odoo, worded on one short line.
|
|
29
|
+
|
|
30
|
+
``unknown_outcome`` is true when the request may have reached the server
|
|
31
|
+
without an answer (timeout, dropped connection, gateway error): a write
|
|
32
|
+
that fails this way is reconciled by reading, never sent again."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, message: str, unknown_outcome: bool = False):
|
|
35
|
+
super().__init__(message)
|
|
36
|
+
self.unknown_outcome = unknown_outcome
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def compact(text: object, limit: int = ERROR_LIMIT) -> str:
|
|
40
|
+
"""The last non-empty line of a server message, cut to ``limit`` characters.
|
|
41
|
+
|
|
42
|
+
Odoo answers an error with a whole Python traceback whose useful part is
|
|
43
|
+
its last line."""
|
|
44
|
+
lines = [line.strip() for line in str(text).strip().splitlines() if line.strip()]
|
|
45
|
+
last = lines[-1] if lines else ""
|
|
46
|
+
return last if len(last) <= limit else last[:limit] + "..."
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def series_of(server_version: str) -> int:
|
|
50
|
+
"""Major series of a ``server_version`` (``16.0-20250909`` gives 16, ``saas~17.2`` gives 17)."""
|
|
51
|
+
match = re.search(r"(\d+)\.\d+", str(server_version))
|
|
52
|
+
if match is None:
|
|
53
|
+
raise OdooRpcError(f"Unrecognised Odoo server version: {server_version!r}")
|
|
54
|
+
return int(match.group(1))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def detect_version(url: str) -> str:
|
|
58
|
+
"""The ``server_version`` of the server at ``url``, without authentication.
|
|
59
|
+
|
|
60
|
+
``/web/version`` exists from Odoo 19 and avoids the deprecated XML-RPC
|
|
61
|
+
endpoints; ``common.version`` answers on every earlier version."""
|
|
62
|
+
try:
|
|
63
|
+
reply = requests.get(f"{url}/web/version", timeout=TIMEOUT)
|
|
64
|
+
if reply.status_code == 200:
|
|
65
|
+
return str(reply.json()["version"])
|
|
66
|
+
except (requests.RequestException, ValueError, KeyError):
|
|
67
|
+
pass
|
|
68
|
+
try:
|
|
69
|
+
return str(xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common").version()["server_version"])
|
|
70
|
+
except (OSError, xmlrpc.client.Error, KeyError) as exc:
|
|
71
|
+
raise OdooRpcError(f"Cannot read the Odoo version at {url}: {compact(exc)}") from None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def choose_channel(requested: str, series: int) -> str:
|
|
75
|
+
if requested not in CHANNELS:
|
|
76
|
+
raise OdooRpcError(f"Unknown channel {requested!r}, expected one of {CHANNELS}")
|
|
77
|
+
if requested == "auto":
|
|
78
|
+
return "json2" if series >= JSON2_FIRST_SERIES else "xmlrpc"
|
|
79
|
+
return requested
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def plain(value: Any) -> Any:
|
|
83
|
+
"""``value`` with plain dicts and lists only.
|
|
84
|
+
|
|
85
|
+
Robot Framework hands a ``DotDict`` to a keyword that received a
|
|
86
|
+
``Create Dictionary``: a dict subclass the XML-RPC marshaller refuses."""
|
|
87
|
+
if isinstance(value, Mapping):
|
|
88
|
+
return {key: plain(item) for key, item in value.items()}
|
|
89
|
+
if isinstance(value, (list, tuple)):
|
|
90
|
+
return [plain(item) for item in value]
|
|
91
|
+
return value
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _context(context: Optional[dict]) -> dict:
|
|
95
|
+
return plain(context) if context else {}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
#: Odoo's XML-RPC fault codes that stand for an exception family: the fault string
|
|
99
|
+
#: is then the bare message, without the exception's name. Any other exception comes
|
|
100
|
+
#: with its traceback, whose last line names it.
|
|
101
|
+
_FAULT_FAMILIES = {
|
|
102
|
+
2: "odoo.exceptions.UserError",
|
|
103
|
+
3: "odoo.exceptions.AccessDenied",
|
|
104
|
+
4: "odoo.exceptions.AccessError",
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _fault_text(fault: xmlrpc.client.Fault) -> str:
|
|
109
|
+
"""The fault as one line that names the Odoo exception (its family for a coded fault).
|
|
110
|
+
|
|
111
|
+
JSON-2 names the exact class (``ValidationError`` for a validation); XML-RPC only
|
|
112
|
+
gives the family of a coded fault (``UserError`` for both)."""
|
|
113
|
+
text = compact(fault.faultString)
|
|
114
|
+
family = _FAULT_FAMILIES.get(fault.faultCode)
|
|
115
|
+
return f"{family}: {text}" if family and family not in text else text
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def server_time(url: str) -> str:
|
|
119
|
+
"""The server's clock as an Odoo datetime string (UTC, one second).
|
|
120
|
+
|
|
121
|
+
Read from the HTTP ``Date`` header of the login page: no authentication, and
|
|
122
|
+
the only clock a client can trust to bracket what it created."""
|
|
123
|
+
try:
|
|
124
|
+
reply = requests.get(f"{url}/web/login", timeout=TIMEOUT)
|
|
125
|
+
stamp = parsedate_to_datetime(reply.headers["Date"])
|
|
126
|
+
except (requests.RequestException, KeyError, TypeError, ValueError) as exc:
|
|
127
|
+
raise OdooRpcError(f"Cannot read the server time at {url}: {compact(exc)}") from None
|
|
128
|
+
return stamp.astimezone(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _send_once(base):
|
|
132
|
+
"""A transport that never replays a request.
|
|
133
|
+
|
|
134
|
+
The standard transport silently sends a request again, once, when the
|
|
135
|
+
connection drops before the answer: harmless for a read, but a write could
|
|
136
|
+
then run twice (a duplicated ``create``)."""
|
|
137
|
+
|
|
138
|
+
class SendOnce(base):
|
|
139
|
+
def request(self, host, handler, request_body, verbose=False):
|
|
140
|
+
return self.single_request(host, handler, request_body, verbose)
|
|
141
|
+
|
|
142
|
+
return SendOnce()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _write_proxy(url: str) -> xmlrpc.client.ServerProxy:
|
|
146
|
+
base = xmlrpc.client.SafeTransport if url.startswith("https") else xmlrpc.client.Transport
|
|
147
|
+
return xmlrpc.client.ServerProxy(url, transport=_send_once(base), allow_none=True)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class XmlRpcChannel:
|
|
151
|
+
"""``execute_kw`` over ``/xmlrpc/2``. Deprecated by Odoo 19, removal announced for 22."""
|
|
152
|
+
|
|
153
|
+
name = "xmlrpc"
|
|
154
|
+
|
|
155
|
+
def __init__(self, url: str, database: str, login: str, password: str):
|
|
156
|
+
self._database = database
|
|
157
|
+
self._password = password
|
|
158
|
+
try:
|
|
159
|
+
common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common")
|
|
160
|
+
self.uid = common.authenticate(database, login, password, {})
|
|
161
|
+
except (OSError, xmlrpc.client.Error) as exc:
|
|
162
|
+
raise OdooRpcError(f"XML-RPC authentication call failed: {compact(exc)}") from None
|
|
163
|
+
if not self.uid:
|
|
164
|
+
raise OdooRpcError(
|
|
165
|
+
f"Authentication refused for login {login!r} on database {database!r}")
|
|
166
|
+
self._object = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object", allow_none=True)
|
|
167
|
+
self._object_once = _write_proxy(f"{url}/xmlrpc/2/object")
|
|
168
|
+
|
|
169
|
+
def __repr__(self) -> str:
|
|
170
|
+
return f"XmlRpcChannel(database={self._database!r}, uid={self.uid})"
|
|
171
|
+
|
|
172
|
+
def _call(self, model: str, method: str, args: list, kwargs: dict,
|
|
173
|
+
write: bool = False) -> Any:
|
|
174
|
+
proxy = self._object_once if write else self._object
|
|
175
|
+
try:
|
|
176
|
+
return proxy.execute_kw(
|
|
177
|
+
self._database, self.uid, self._password, model, method,
|
|
178
|
+
plain(args), plain(kwargs))
|
|
179
|
+
except xmlrpc.client.Fault as exc:
|
|
180
|
+
if NONE_RESULT in exc.faultString:
|
|
181
|
+
raise OdooRpcError(
|
|
182
|
+
f"{model}.{method} ran on the server but its None result cannot be sent "
|
|
183
|
+
"over XML-RPC (an Odoo limitation): read the record to see the effect",
|
|
184
|
+
unknown_outcome=True) from None
|
|
185
|
+
raise OdooRpcError(f"{model}.{method} failed: {_fault_text(exc)}") from None
|
|
186
|
+
except TypeError as exc:
|
|
187
|
+
raise OdooRpcError(f"{model}.{method} arguments cannot be encoded: {compact(exc)}") from None
|
|
188
|
+
except (OSError, xmlrpc.client.Error) as exc:
|
|
189
|
+
raise OdooRpcError(f"{model}.{method} unreachable: {compact(exc)}",
|
|
190
|
+
unknown_outcome=True) from None
|
|
191
|
+
|
|
192
|
+
def search_count(self, model: str, domain: list, context: Optional[dict] = None) -> int:
|
|
193
|
+
return self._call(model, "search_count", [domain], {"context": _context(context)})
|
|
194
|
+
|
|
195
|
+
def search_read(self, model: str, domain: list, fields: Optional[list] = None,
|
|
196
|
+
limit: int = 0, offset: int = 0, order: str = "",
|
|
197
|
+
context: Optional[dict] = None) -> list:
|
|
198
|
+
kwargs: dict = {"context": _context(context)}
|
|
199
|
+
if fields:
|
|
200
|
+
kwargs["fields"] = fields
|
|
201
|
+
if limit:
|
|
202
|
+
kwargs["limit"] = limit
|
|
203
|
+
if offset:
|
|
204
|
+
kwargs["offset"] = offset
|
|
205
|
+
if order:
|
|
206
|
+
kwargs["order"] = order
|
|
207
|
+
return self._call(model, "search_read", [domain], kwargs)
|
|
208
|
+
|
|
209
|
+
def fields_get(self, model: str, attributes: Optional[list] = None,
|
|
210
|
+
context: Optional[dict] = None) -> dict:
|
|
211
|
+
kwargs: dict = {"context": _context(context)}
|
|
212
|
+
if attributes:
|
|
213
|
+
kwargs["attributes"] = attributes
|
|
214
|
+
return self._call(model, "fields_get", [], kwargs)
|
|
215
|
+
|
|
216
|
+
def create(self, model: str, values: dict, context: Optional[dict] = None) -> int:
|
|
217
|
+
return self._call(model, "create", [values], {"context": _context(context)}, write=True)
|
|
218
|
+
|
|
219
|
+
def write(self, model: str, ids: list, values: dict, context: Optional[dict] = None) -> bool:
|
|
220
|
+
return self._call(model, "write", [ids, values], {"context": _context(context)},
|
|
221
|
+
write=True)
|
|
222
|
+
|
|
223
|
+
def unlink(self, model: str, ids: list, context: Optional[dict] = None) -> bool:
|
|
224
|
+
return self._call(model, "unlink", [ids], {"context": _context(context)}, write=True)
|
|
225
|
+
|
|
226
|
+
def call(self, model: str, method: str, ids: list, kwargs: Optional[dict] = None,
|
|
227
|
+
context: Optional[dict] = None) -> Any:
|
|
228
|
+
return self._call(model, method, [ids], {**(kwargs or {}), "context": _context(context)},
|
|
229
|
+
write=True)
|
|
230
|
+
|
|
231
|
+
def close(self) -> None:
|
|
232
|
+
self._object("close")()
|
|
233
|
+
self._object_once("close")()
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class Json2Channel:
|
|
237
|
+
"""``POST /json/2/<model>/<method>`` with a ``Bearer`` API key (Odoo 19 and later).
|
|
238
|
+
|
|
239
|
+
Arguments go by name; the answer is the method's return value, errors are
|
|
240
|
+
HTTP statuses."""
|
|
241
|
+
|
|
242
|
+
name = "json2"
|
|
243
|
+
|
|
244
|
+
def __init__(self, url: str, database: str, api_key: str):
|
|
245
|
+
self._url = url
|
|
246
|
+
self._database = database
|
|
247
|
+
self._session = requests.Session()
|
|
248
|
+
self._session.headers["Authorization"] = f"Bearer {api_key}"
|
|
249
|
+
if database:
|
|
250
|
+
self._session.headers["X-Odoo-Database"] = database
|
|
251
|
+
self.uid = self._call("res.users", "context_get", {}).get("uid")
|
|
252
|
+
|
|
253
|
+
def __repr__(self) -> str:
|
|
254
|
+
return f"Json2Channel(database={self._database!r}, uid={self.uid})"
|
|
255
|
+
|
|
256
|
+
def _call(self, model: str, method: str, payload: dict) -> Any:
|
|
257
|
+
try:
|
|
258
|
+
reply = self._session.post(
|
|
259
|
+
f"{self._url}/json/2/{model}/{method}", json=plain(payload), timeout=TIMEOUT)
|
|
260
|
+
except requests.RequestException as exc:
|
|
261
|
+
raise OdooRpcError(f"{model}.{method} unreachable: {compact(exc)}",
|
|
262
|
+
unknown_outcome=True) from None
|
|
263
|
+
if reply.status_code != 200:
|
|
264
|
+
raise OdooRpcError(
|
|
265
|
+
f"{model}.{method} answered HTTP {reply.status_code}: {self._message(reply)}",
|
|
266
|
+
unknown_outcome=reply.status_code in GATEWAY_ERRORS)
|
|
267
|
+
return reply.json()
|
|
268
|
+
|
|
269
|
+
@staticmethod
|
|
270
|
+
def _message(reply: requests.Response) -> str:
|
|
271
|
+
try:
|
|
272
|
+
body = reply.json()
|
|
273
|
+
message = compact(body.get("message") or reply.reason)
|
|
274
|
+
name = body.get("name")
|
|
275
|
+
return f"{name}: {message}" if name else message
|
|
276
|
+
except (ValueError, AttributeError):
|
|
277
|
+
return compact(reply.reason or reply.text)
|
|
278
|
+
|
|
279
|
+
def search_count(self, model: str, domain: list, context: Optional[dict] = None) -> int:
|
|
280
|
+
return self._call(model, "search_count",
|
|
281
|
+
{"domain": domain, "context": _context(context)})
|
|
282
|
+
|
|
283
|
+
def search_read(self, model: str, domain: list, fields: Optional[list] = None,
|
|
284
|
+
limit: int = 0, offset: int = 0, order: str = "",
|
|
285
|
+
context: Optional[dict] = None) -> list:
|
|
286
|
+
payload: dict = {"domain": domain, "context": _context(context)}
|
|
287
|
+
if fields:
|
|
288
|
+
payload["fields"] = fields
|
|
289
|
+
if limit:
|
|
290
|
+
payload["limit"] = limit
|
|
291
|
+
if offset:
|
|
292
|
+
payload["offset"] = offset
|
|
293
|
+
if order:
|
|
294
|
+
payload["order"] = order
|
|
295
|
+
return self._call(model, "search_read", payload)
|
|
296
|
+
|
|
297
|
+
def fields_get(self, model: str, attributes: Optional[list] = None,
|
|
298
|
+
context: Optional[dict] = None) -> dict:
|
|
299
|
+
payload: dict = {"context": _context(context)}
|
|
300
|
+
if attributes:
|
|
301
|
+
payload["attributes"] = attributes
|
|
302
|
+
return self._call(model, "fields_get", payload)
|
|
303
|
+
|
|
304
|
+
def create(self, model: str, values: dict, context: Optional[dict] = None) -> int:
|
|
305
|
+
created = self._call(model, "create",
|
|
306
|
+
{"vals_list": [values], "context": _context(context)})
|
|
307
|
+
return created[0] if isinstance(created, list) else created
|
|
308
|
+
|
|
309
|
+
def write(self, model: str, ids: list, values: dict, context: Optional[dict] = None) -> bool:
|
|
310
|
+
return self._call(model, "write",
|
|
311
|
+
{"ids": ids, "vals": values, "context": _context(context)})
|
|
312
|
+
|
|
313
|
+
def unlink(self, model: str, ids: list, context: Optional[dict] = None) -> bool:
|
|
314
|
+
return self._call(model, "unlink", {"ids": ids, "context": _context(context)})
|
|
315
|
+
|
|
316
|
+
def call(self, model: str, method: str, ids: list, kwargs: Optional[dict] = None,
|
|
317
|
+
context: Optional[dict] = None) -> Any:
|
|
318
|
+
return self._call(model, method,
|
|
319
|
+
{**(kwargs or {}), "ids": ids, "context": _context(context)})
|
|
320
|
+
|
|
321
|
+
def close(self) -> None:
|
|
322
|
+
self._session.close()
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def open_channel(url: str, database: str, login: str, secret: str, channel: str):
|
|
326
|
+
"""The channel named by ``channel`` (resolved against the server version by the caller)."""
|
|
327
|
+
if channel == "json2":
|
|
328
|
+
return Json2Channel(url, database, secret)
|
|
329
|
+
return XmlRpcChannel(url, database, login, secret)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: robotframework-odoofx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ODOOFX: Robot Framework library for testing Odoo over its external API (XML-RPC up to Odoo 18, JSON-2 from Odoo 19), with opt-in journaled writes. Web channel in bootstrap.
|
|
5
|
+
Author-email: Cyril Montiel <cyril@montiel.me>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/CyrilM29/robotframework-odoofx
|
|
8
|
+
Project-URL: Documentation, https://cyrilm29.github.io/robotframework-odoofx/
|
|
9
|
+
Project-URL: Repository, https://github.com/CyrilM29/robotframework-odoofx
|
|
10
|
+
Project-URL: Issue Tracker, https://github.com/CyrilM29/robotframework-odoofx/issues
|
|
11
|
+
Keywords: robotframework,robot-framework,test-automation,testing,qa,odoo,erp,orm,rpc,xml-rpc,json-2
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Framework :: Robot Framework
|
|
16
|
+
Classifier: Framework :: Robot Framework :: Library
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Classifier: Topic :: Software Development :: Testing :: Acceptance
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
License-File: NOTICE
|
|
31
|
+
Requires-Dist: robotframework>=7.4
|
|
32
|
+
Requires-Dist: requests>=2.28.0
|
|
33
|
+
Provides-Extra: web
|
|
34
|
+
Requires-Dist: robotframework-browser<21,>=20.0; extra == "web"
|
|
35
|
+
Provides-Extra: all
|
|
36
|
+
Requires-Dist: robotframework-odoofx[web]; extra == "all"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# ODOOFX: Odoo library for Robot Framework
|
|
40
|
+
|
|
41
|
+
`OdooFxLibrary` brings Odoo test automation to Robot Framework. Today it talks
|
|
42
|
+
to Odoo through its external API: XML-RPC up to Odoo 18, JSON-2 from Odoo 19,
|
|
43
|
+
behind one keyword vocabulary that reads records and state codes, and writes
|
|
44
|
+
only when the connection opts in, with a journal of every write. It targets
|
|
45
|
+
Odoo Community and Enterprise. The web interface (Browser library) is the next
|
|
46
|
+
channel.
|
|
47
|
+
|
|
48
|
+
This repository publishes the **library sources** and, as they are written,
|
|
49
|
+
the documentation that concerns the library and its keyword reference.
|
|
50
|
+
|
|
51
|
+
> **Status (0.1.0, 2026-10-05): bootstrap.** The RPC channel works, reads and
|
|
52
|
+
> writes, proven live on Odoo 16 (XML-RPC) and Odoo 19.0-20260908 (XML-RPC and
|
|
53
|
+
> JSON-2). Writes are off unless the connection opts in. The web channel is a
|
|
54
|
+
> skeleton that only warns. Signatures may still change before 1.0.
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install robotframework-odoofx
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Requirements: Python 3.10 or later, Robot Framework 7.4 or later, and an Odoo
|
|
63
|
+
instance reachable over HTTP (designed for Odoo 14 and later, proven on 16 and
|
|
64
|
+
19). The `web` extra
|
|
65
|
+
(`pip install "robotframework-odoofx[web]"`, then `rfbrowser init` once for
|
|
66
|
+
the Playwright browsers) brings the Browser library for the coming web channel;
|
|
67
|
+
`all` installs every extra.
|
|
68
|
+
|
|
69
|
+
Keyword documentation:
|
|
70
|
+
[cyrilm29.github.io/robotframework-odoofx](https://cyrilm29.github.io/robotframework-odoofx/).
|
|
71
|
+
|
|
72
|
+
## Keywords of the current version
|
|
73
|
+
|
|
74
|
+
| Keyword | Purpose |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `Connect To Odoo` | Prove the target (URL, database, version) and open the RPC connection; `channel=auto` picks JSON-2 from Odoo 19, XML-RPC before; `allow_write` opts in to writes, `expected_series` refuses another Odoo version |
|
|
77
|
+
| `Get Odoo Connection Info` | The proven target of the current connection, never the secret |
|
|
78
|
+
| `Count Odoo Records` | Count the records of a model matching a domain |
|
|
79
|
+
| `Search Read Odoo Records` | Read the records of a model matching a domain |
|
|
80
|
+
| `Get Field Selection Values` | The technical codes of a selection field |
|
|
81
|
+
| `Count Odoo Records By State` | Record count per state code |
|
|
82
|
+
| `Get Odoo Record State` | The state code of one identified record |
|
|
83
|
+
| `Odoo Record State Should Be` | Fail unless the identified record is in the expected state code |
|
|
84
|
+
| `Assert Quotation Status Is` | Check a quotation's state code, by order reference or id |
|
|
85
|
+
| `Create Odoo Record`, `Update Odoo Record`, `Delete Odoo Record` | Write a record (needs `allow_write`) |
|
|
86
|
+
| `Call Odoo Record Method` | Call a model method such as `action_confirm` or `action_cancel` (needs `allow_write`) |
|
|
87
|
+
| `Get Odoo Write Journal` | Every write (after entry `since`) with its phase: `planned`, `done`, `failed` or `unknown` (to read back, never to resend) |
|
|
88
|
+
| `Odoo Write Journal Should Hold No Unknown Outcome`, `Odoo Last Write Should Be` | Assert on the journal: no write of unknown effect, the last write in a given phase |
|
|
89
|
+
| `Reconcile Odoo Write` | Settle a `planned` or `unknown` journal entry after reading the record back |
|
|
90
|
+
| `Get Odoo Config Parameter` | A system parameter such as `web.base.url` (administrator) |
|
|
91
|
+
| `Odoo User Should Be In Group`, `Odoo User Should Not Be In Group` | Group membership of a user, the group named by its external id |
|
|
92
|
+
| `New Odoo Run Marker` | A unique label to put in a free-text field of the records a run creates |
|
|
93
|
+
| `Get Odoo Server Time` | The server's clock (UTC, one second), to bracket what a run created |
|
|
94
|
+
| `Resolve Odoo External Id` | The database id behind an external id such as `product.product_product_1`, proved to be of the expected model |
|
|
95
|
+
| `Get Odoo Record` | One identified record, whole or by fields |
|
|
96
|
+
| `Odoo Record Exists` | Whether a record exists (archived ones count) |
|
|
97
|
+
| `Odoo Record Should Exist`, `Odoo Record Should Not Exist` | Prove a presence or a removal on the identified record |
|
|
98
|
+
| `Disconnect From Odoo` | Close the connection |
|
|
99
|
+
| `Navigate To Menu` | Skeleton (web channel), only warns |
|
|
100
|
+
| `Create New Quotation` | Skeleton, only warns |
|
|
101
|
+
|
|
102
|
+
```robotframework
|
|
103
|
+
*** Settings ***
|
|
104
|
+
Library OdooFxLibrary
|
|
105
|
+
|
|
106
|
+
*** Test Cases ***
|
|
107
|
+
Read A Quotation State
|
|
108
|
+
Connect To Odoo http://localhost:8069 my_database admin ${PASSWORD} channel=xmlrpc
|
|
109
|
+
Assert Quotation Status Is sale S00004
|
|
110
|
+
[Teardown] Disconnect From Odoo
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
States are compared by code (`draft`, `sent`, `sale`, `cancel`), never by the
|
|
114
|
+
translated label: a label fails the assertion as "not a state code".
|
|
115
|
+
|
|
116
|
+
Credentials never live in a suite: pass them on the command line
|
|
117
|
+
(`robot -v "PASSWORD: Secret:..." suite.robot`, the Robot Framework 7.4 typed
|
|
118
|
+
variable keeps them out of the logs) or through the environment.
|
|
119
|
+
|
|
120
|
+
## Layout
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
src/OdooFxLibrary/ the library
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Issues
|
|
127
|
+
|
|
128
|
+
Bug reports and suggestions are welcome as
|
|
129
|
+
[GitHub issues](https://github.com/CyrilM29/robotframework-odoofx/issues).
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
Apache 2.0. See [LICENSE](https://github.com/CyrilM29/robotframework-odoofx/blob/main/LICENSE) and [NOTICE](https://github.com/CyrilM29/robotframework-odoofx/blob/main/NOTICE).
|
|
134
|
+
|
|
135
|
+
## Trademarks
|
|
136
|
+
|
|
137
|
+
Odoo is a trademark of Odoo S.A. Robot Framework is a trademark of the Robot
|
|
138
|
+
Framework Foundation. ODOOFX is an independent project, not affiliated with,
|
|
139
|
+
sponsored or endorsed by Odoo S.A. or the Robot Framework Foundation.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
OdooFxLibrary/__init__.py,sha256=q6i7QxnFUt0wjqn-UfIe0KeSpgLsaRQCuGJY6iepq34,341
|
|
2
|
+
OdooFxLibrary/odoo_library.py,sha256=aednR7UMfpmiw1eyCqhMJ-dwox7l0NfJl66NT2WpZ6w,24320
|
|
3
|
+
OdooFxLibrary/rpc.py,sha256=djgnGI497g1inq73MJ74A4Pf9C_HC9kibR9VqnHIXww,14060
|
|
4
|
+
robotframework_odoofx-0.1.0.dist-info/licenses/LICENSE,sha256=kaWqhhDdR_ECV5CguYmDkNSQGCOet9SnYtLC97pXujY,7036
|
|
5
|
+
robotframework_odoofx-0.1.0.dist-info/licenses/NOTICE,sha256=DxV97ExiP1QmVdjaej6w2twxNjY8NJMYirtEiE8NQCE,1794
|
|
6
|
+
robotframework_odoofx-0.1.0.dist-info/METADATA,sha256=fSQRlc-NjT5XX1fpV1fxY0ZvVmKPqw1wSBVJCjkQaFQ,7171
|
|
7
|
+
robotframework_odoofx-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
8
|
+
robotframework_odoofx-0.1.0.dist-info/top_level.txt,sha256=TtXC6WxniXa21_v9bbDiG0J7ZOzsacClDEzoSgmcMZo,14
|
|
9
|
+
robotframework_odoofx-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined in Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
24
|
+
permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or Object
|
|
36
|
+
form, made available under the License, as indicated by a copyright
|
|
37
|
+
notice that is included in or attached to the work (an example is
|
|
38
|
+
provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship, thus excluding
|
|
44
|
+
simple aggregations of unmodified components or the mere inclusion
|
|
45
|
+
of the Work unmodified in a container with other unmodified works or
|
|
46
|
+
portions thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any Derivative Works thereof,
|
|
50
|
+
submitted to, displayed by, or received by Licensor for inclusion
|
|
51
|
+
in the Work by the copyright owner or by an individual or Legal
|
|
52
|
+
Entity authorized to submit on behalf of the copyright owner. For
|
|
53
|
+
the purposes of this definition, "submitted" means any form of
|
|
54
|
+
electronic, verbal, or written communication sent to the Licensor
|
|
55
|
+
or its representatives.
|
|
56
|
+
|
|
57
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf
|
|
58
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
59
|
+
incorporated within the Work.
|
|
60
|
+
|
|
61
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
65
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
66
|
+
Work and such Derivative Works in Source or Object form.
|
|
67
|
+
|
|
68
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
(except as stated in this section) patent license to make, have made,
|
|
72
|
+
use, offer to sell, sell, import, and otherwise transfer the Work.
|
|
73
|
+
|
|
74
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
75
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
76
|
+
modifications, and in Source or Object form, provided that You
|
|
77
|
+
meet the following conditions:
|
|
78
|
+
|
|
79
|
+
(a) You must give any other recipients of the Work or
|
|
80
|
+
Derivative Works a copy of this License; and
|
|
81
|
+
|
|
82
|
+
(b) You must cause any modified files to carry prominent notices
|
|
83
|
+
stating that You changed the files; and
|
|
84
|
+
|
|
85
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
86
|
+
that You distribute, all copyright, patent, trademark, and
|
|
87
|
+
attribution notices from the Source form of the Work,
|
|
88
|
+
excluding those notices that do not pertain to any part of
|
|
89
|
+
the Derivative Works; and
|
|
90
|
+
|
|
91
|
+
(d) If the Work includes a "NOTICE" text file, then any
|
|
92
|
+
Derivative Works that You distribute must include a readable
|
|
93
|
+
copy of the attribution notices contained
|
|
94
|
+
within such NOTICE file.
|
|
95
|
+
|
|
96
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
97
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
98
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
99
|
+
this License, without any additional terms or conditions.
|
|
100
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
101
|
+
the terms of any separate license agreement you may have executed
|
|
102
|
+
with Licensor regarding such Contribution.
|
|
103
|
+
|
|
104
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
105
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
106
|
+
except as required for reasonable and customary use in describing the
|
|
107
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
108
|
+
|
|
109
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
110
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
111
|
+
Contributor provides its Contributions) on an "AS-IS" BASIS,
|
|
112
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
113
|
+
implied, including, without limitation, any warranties or conditions
|
|
114
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
115
|
+
PARTICULAR PURPOSE.
|
|
116
|
+
|
|
117
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
118
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
119
|
+
unless required by applicable law (such as deliberate and grossly
|
|
120
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
121
|
+
liable to You for damages, including any direct, indirect, special,
|
|
122
|
+
incidental, or consequential damages of any character arising as a
|
|
123
|
+
result of this License or out of the use or inability to use the
|
|
124
|
+
Work.
|
|
125
|
+
|
|
126
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
127
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
128
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
129
|
+
or other liability obligations and/or rights consistent with this
|
|
130
|
+
License. However, in accepting such obligations, You may act only
|
|
131
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
132
|
+
of any other Contributor.
|
|
133
|
+
|
|
134
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ODOOFX
|
|
2
|
+
Copyright 2026 Cyril Montiel
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE file).
|
|
5
|
+
|
|
6
|
+
================================================================================
|
|
7
|
+
THIRD-PARTY COMPONENTS
|
|
8
|
+
================================================================================
|
|
9
|
+
|
|
10
|
+
The robotframework-odoofx package contains no third-party code. It depends on
|
|
11
|
+
the following projects, installed from PyPI under their own licenses:
|
|
12
|
+
|
|
13
|
+
1. Robot Framework
|
|
14
|
+
- Project: https://robotframework.org/
|
|
15
|
+
- License: Apache License 2.0
|
|
16
|
+
- Used for: keyword library API, typed secrets, test execution
|
|
17
|
+
|
|
18
|
+
2. Requests
|
|
19
|
+
- Project: https://requests.readthedocs.io/
|
|
20
|
+
- License: Apache License 2.0
|
|
21
|
+
- Used for: the JSON-2 channel (Odoo 19 and later)
|
|
22
|
+
|
|
23
|
+
3. Robot Framework Browser library (optional, `web` extra)
|
|
24
|
+
- Project: https://github.com/MarketSquare/robotframework-browser
|
|
25
|
+
- License: Apache License 2.0
|
|
26
|
+
- Used for: the web channel, through Playwright
|
|
27
|
+
(https://playwright.dev/, Apache License 2.0)
|
|
28
|
+
|
|
29
|
+
================================================================================
|
|
30
|
+
DESIGN LINEAGE
|
|
31
|
+
================================================================================
|
|
32
|
+
|
|
33
|
+
The method around the library (spec-driven test agents, guards) follows
|
|
34
|
+
rf-test-agents (https://github.com/CyrilM29/rf-test-agents, Apache License
|
|
35
|
+
2.0, same author). No code of it is part of this package.
|
|
36
|
+
|
|
37
|
+
================================================================================
|
|
38
|
+
TRADEMARKS
|
|
39
|
+
================================================================================
|
|
40
|
+
|
|
41
|
+
Odoo is a trademark of Odoo S.A. Robot Framework is a trademark of the Robot
|
|
42
|
+
Framework Foundation. ODOOFX is an independent project, not affiliated with,
|
|
43
|
+
sponsored or endorsed by Odoo S.A. or the Robot Framework Foundation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
OdooFxLibrary
|