Hi,
Can you tell me How add a sort on a column in a tree view
Thanks
Hey, Sylvie, what do you really mean?
You are allowed to order by any field in the database just clicking on it in the tree view. If you want to filter by a function field, then you will need to define an order function.
If what you want is to order a tree view by default, then you will need to define a general order to the class or to a specific action as for example it’s done here .
¿Which is your case?
I want to make a sort on a function field in a tree view just clicking on it in the tree view like database field
You need to define an order_
function which returns the columns defining the order of the field.
Here is documentation that explains such heature:
https://docs.tryton.org/projects/server/en/latest/ref/models/fields.html?highlight=order#ordering
Small example here: modules/purchase_request_quotation: 8bb8d6dc5151 purchase.py
A post was split to a new topic: How to write order function based on Dict value