Is there any way to update tree/form string attribute dynamically based on certain field value? I’ve tried to add the logic in view_attributes() but it did not work.
The quantity string will be updated based on transfer_type value. If user select “request” type, the quantity will be displayed as “Request Quantity” instead.
For tree views this is impossible AFAIK, since the column name is independent of the list of records.
For form views, a workaround would be to define a separate Function (Char) field, and use it as a label for the field.
So the string value would be computed in the function field getter, and displayed in place of the label of the main field.
No the string of labels are static. This is mainly because they are used on list as column header.
On form you can put some labels in side the same group and make them visible one at a time using a PYSON expression on each one.
But the general idea of Tryton is that a field represents a unique concept.
Thank you for your prompt reply. I was thinking to use view_ids on field to separate the form and tree views. Is there any way to dynamically set the view_ids based on record value?
For instance, set the view_ids to X when Eval(‘transfer_type’) ==‘request’ whereas set the view_ids to Y when Eval(‘transfer_type’) ==‘return’.