details: https://code.tryton.org/tryton/commit/c8bb26f0aba1
branch: 7.8
user: Cédric Krier <[email protected]>
date: Mon Oct 05 18:21:13 2026 +0200
description:
Allow to create any action from the UI
The action field must not be used to create the main action and the
inherited
fields from the parent action must not be set a second time.
Closes #15149
(grafted from 08c5c82cd1e2cb19a8877b706803dd03481863eb)
diffstat:
trytond/trytond/ir/action.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 134c3265992e -r c8bb26f0aba1 trytond/trytond/ir/action.py
--- a/trytond/trytond/ir/action.py Fri Oct 02 23:00:51 2026 +0200
+++ b/trytond/trytond/ir/action.py Mon Oct 05 18:21:13 2026 +0200
@@ -346,7 +346,11 @@
action = fields.Many2One(
'ir.action', "Action",
- required=True, readonly=True, ondelete='CASCADE')
+ required=True, ondelete='CASCADE',
+ states={
+ 'required': Eval('id', -1) >= 0,
+ 'readonly': Eval('id', -1) >= 0,
+ })
@classmethod
def __setup__(cls):
@@ -458,8 +462,9 @@
values = values.copy()
for field in values:
if field in Action._fields:
- action_values[field] = values[field]
- if hasattr(getattr(cls, field), 'set'):
+ if field != 'action':
+ action_values[field] = values[field]
+ elif hasattr(getattr(cls, field), 'set'):
later[field] = values[field]
for field in later:
del values[field]
@@ -470,7 +475,7 @@
if database.nextid(transaction.connection, cls._table):
database.setnextid(transaction.connection, cls._table,
database.currid(transaction.connection, Action._table))
- if 'action' not in values:
+ if not values.get('action'):
action, = Action.create([action_values])
values['action'] = action.id
else: