Issue 11488

Title
required or readonly attributes have precedence over states
Priority
feature
Status
testing
Nosy list
acaubet, ced, reviewbot
Assigned to
acaubet
Keywords
easy, review

Created on 2022-05-16.13:23:28 by acaubet, last changed 3 months ago by reviewbot.

Messages

Author: [hidden] (acaubet)
Date: 2022-05-16.14:57:20

After asking on IRC, you mention a interesting fact that can be included on docs https://www.tryton.org/~irclog/2021-12-29.log.html#t13:12.
In case someone needs to change an attribute on the states but this attribute is set on core module, the change won't take action as the attributes have preference over the states.
So if you want to overwrite with:

cls.number.states['readonly'] = (Eval('state') != 'draft')

You need to do the following if the core module sets readonly=True.

cls.number.readonly = False
cls.number.states['readonly'] = (Eval('state') != 'draft')
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-05-16.13:42:24

I do not understand what this is about?

Author: [hidden] (acaubet)
Date: 2022-05-16.13:23:28

From https://www.tryton.org/~irclog/2021-12-29.log.html
So it's interesting to note that on docs
As this can not work if the attribute is directly defined on the field.
cls.<field name>.states['readonly'] = <PYSON expresion>
You need to do:
cls.<field name>.readonly = <PYSON expresion>

History
Date User Action Args
2022-08-11 13:46:28reviewbotsetmessages: + msg77672
2022-06-22 10:37:58reviewbotsetmessages: + msg77202
2022-06-21 11:37:03reviewbotsetmessages: + msg77191
2022-06-20 11:36:20reviewbotsetmessages: + msg77134
2022-05-16 14:57:20acaubetsetmessages: + msg76675
2022-05-16 13:53:45reviewbotsetmessages: + msg76669
nosy: + reviewbot
2022-05-16 13:42:24cedsetmessages: + msg76668
nosy: + ced
2022-05-16 13:26:45acaubetsetkeyword: + review
reviews: 447091003
status: in-progress -> testing
2022-05-16 13:23:28acaubetcreate

Showing 10 items. Show all history (warning: this could be VERY long)