details: https://code.tryton.org/tryton/commit/cde086016dd5
branch: default
user: Cédric Krier <[email protected]>
date: Sun Dec 14 13:57:42 2025 +0100
description:
Test action window using existing records from the keywords
Since 225529c5e779 the ids do not start at 1 so it must search for
existing
records to test.
diffstat:
trytond/trytond/tests/test_tryton.py | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diffs (44 lines):
diff -r 715161fe8b33 -r cde086016dd5 trytond/trytond/tests/test_tryton.py
--- a/trytond/trytond/tests/test_tryton.py Fri Nov 14 18:11:20 2025 +0100
+++ b/trytond/trytond/tests/test_tryton.py Sun Dec 14 13:57:42 2025 +0100
@@ -1005,15 +1005,34 @@
if not action_window.res_model:
return
Model = pool.get(action_window.res_model)
- for active_id, active_ids in [
- (None, []),
- (1, [1]),
- (1, [1, 2]),
- ]:
+ actives = [(None, [], action_window.res_model)]
+ for keyword in action_window.keywords:
+ if not keyword.model:
+ continue
+ if isinstance(keyword.model, str):
+ kModel = pool.get(keyword.model.split(',', 1)[0])
+ ids = [r.id for r in kModel.search([], limit=2)]
+ if ids:
+ actives.append((
+ ids[0],
+ [ids[0]],
+ kModel.__name__))
+ if len(ids) > 1:
+ actives.append((
+ ids[0],
+ ids,
+ kModel.__name__))
+ else:
+ actives.append((
+ keyword.id,
+ [keyword.id],
+ keyword.model.__name__))
+
+ for active_id, active_ids, active_model in actives:
decoder = PYSONDecoder({
'active_id': active_id,
'active_ids': active_ids,
- 'active_model': action_window.res_model,
+ 'active_model': active_model,
})
domain = decoder.decode(action_window.pyson_domain)
order = decoder.decode(action_window.pyson_order)