details:   https://code.tryton.org/tryton/commit/fac6ce2927da
branch:    default
user:      Cédric Krier <[email protected]>
date:      Wed Sep 30 09:35:55 2026 +0200
description:
        Make type and action fields readonly only after creation

        The user needs to be allowed to set those fields when creating or 
copying an
        action.
diffstat:

 trytond/trytond/ir/action.py |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 3f014f4df054 -r fac6ce2927da trytond/trytond/ir/action.py
--- a/trytond/trytond/ir/action.py      Tue Sep 29 17:17:01 2026 +0200
+++ b/trytond/trytond/ir/action.py      Wed Sep 30 09:35:55 2026 +0200
@@ -54,7 +54,10 @@
     __name__ = 'ir.action'
     name = fields.Char('Name', required=True, translate=True)
     type = fields.Selection(
-        ACTION_SELECTION, "Type", required=True, readonly=True)
+        ACTION_SELECTION, "Type", required=True,
+        states={
+            'readonly': Eval('id', -1) >= 0,
+            })
     action = fields.Function(
         fields.Reference("Action", selection=ACTION_SELECTION),
         'get_action')
@@ -345,7 +348,10 @@
 
     action = fields.Many2One(
         'ir.action', "Action",
-        required=True, readonly=True, ondelete='CASCADE')
+        required=True, ondelete='CASCADE',
+        states={
+            'readonly': Eval('id', -1) >= 0,
+            })
 
     @classmethod
     def __setup__(cls):

Reply via email to