Having ModelSQL.write obey readonly set in states.
19 views
Skip to first unread message
Jon Levy
unread,
Aug 16, 2016, 2:29:15 PM8/16/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tryton
I have a bit of code that calls ModelSQL.write([active_records], {values}) and have found that it will write to a field even if that field is readonly, per the `states` of the Model. Is this the expected behavior, and is there a way to have `write` honor the constraint set in `states`?
I'm using 3.4
Cédric Krier
unread,
Aug 16, 2016, 3:35:16 PM8/16/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tryton
This is the expected behaviour for now.
The read-only had always meaning only for user but we should try to
enforce it, see https://bugs.tryton.org/issue4207
But if you need a really strong enforcement, you must override the write
method to raise an error in this case.