That is exactly the thing my customer is complaining about: “Why on Earth I should click three times on the header to see the most recent record on top?!”
It’s something that they should do only if the default do not suit them in one rare occurence.
Otherwise as @sergyo said you can also adapt the default to their liking.
Yes, my customer always need the most recent record on top, that is not the default behavior.
I did exactly as it was proposed by @sergyo! And I like it. I didn’t understand that way from the docs. He pointing me to the example and — that was what I need.
I ended with the following solution:
Yes, I know about id, I just left both for having the ability to switch between these two ways to which it would be better for the customer. And we finally agreed on the id version, so assess_datetime is excessive and should be removed.
Thank you, I will try ModelSQL._order with another view…
class SaleAnalytics(ModelSQL, ModelView):
# description (mandatory on first declaration)
'Sale Analytics'
# Internal class name. Always used as a reference inside Tryton
# default: '<module_name>.<class_name>' on Tryton
# becomes '<module_name>_<class_name>' in the database
__name__ = 'mymodule.analytics.sales'
_order_name = 'report_date'
_order = [('report_date', 'DESC')]
I shared it as it seems to work fine. For those who follow my path…