Add name order on all models by default


(Sergi Almacellas Abellana) #1

Rational

I’ve noticed that we have a inconsitent behaviour in the ordering of some models of master data. Let me explain, the Invoice Payment Terms are sorted by name by default but the Invoice Payment Method, the account Payment Method and the Payment Journal are not sorted by name but only using the default filter.

I think for a better UX it will be great if all the master data follow the same pattern and thus order by name by default.

Proposal

Having said that, my doubt is if it’s worth to adopt a generic solution for all models or not: Some options that come to my mind:

  • Sort by default by rec_name: As rec_name is a functional field we should define an order function which will sort by name (if the model has one) and id (to keep the current behaviour)
  • Add name as default sort criteria if the model has a name attribute

The other option is to manually add the name criteria on all the required models.

What do you think? Does it make sense to order all named models by default?

Implementation


(Cédric Krier) #2

For me, this should be discussed case by case. There are no standard solution for this as it completely depend of the usage, expectation etc.


(Sergi Almacellas Abellana) #3

Most of the times the models that have a name field are used to represent some master data that will be used for encoding documents. Here is an extensive (but not complete) list of models that have a Char name field

  • Party
  • Product
  • Payment Term
  • Account
  • Invoice Payment Data
  • Statement Journal
  • Payment Journal
  • User
  • Group
  • Actions
  • Triggers
  • Language
  • Unit of Measure
  • Stock Location
  • Subscription Recurrence
  • Production BOM
  • Product Category
  • Party Category
  • Dunning procedure

(Cédric Krier) #4

This is for example a dangerous one as the name is translatable. If we always order on it, this force to make a join on the translation table. And we know that it can be a performance killer for large database.

Idem about translation but this one we can guess that there are only a few so the performance is not a problem. That’s why it is already ordered.

So for me, it is pointless to list all the Model like that. It is better to open an issue for those you think should be different.


(Sergi Almacellas Abellana) #5

Created Issue 7971: Add name orderding on some models - Tryton issue tracker