Tryton - Issues

 

Issue8880

Title Get clients to use a better default position for new records
Priority feature Status resolved
Superseder Nosy List albertca, ced, reviewbot, roundup-bot
Type feature request Components sao, tryton, trytond
Assigned To ced Keywords review
Reviews 276501003, 284691003
View: 276501003, 284691003

Created on 2019-11-29.13:37:10 by ced, last changed by roundup-bot.

Messages
New changeset 87a99fc5181d by Cédric Krier in branch 'default':
Manage empty direction when updating arrows
https://hg.tryton.org/tryton-env/rev/87a99fc5181d
New changeset 5588f4742fb0 by Cédric Krier in branch 'default':
Manage empty direction when updating arrows
https://hg.tryton.org/tryton/rev/5588f4742fb0
New changeset 5d2f72767b41 by Cédric Krier in branch 'default':
Manage empty direction when updating arrows
https://hg.tryton.org/sao/rev/5d2f72767b41
New review284691003 at https://codereview.tryton.org/284691003/#ps289061002
New changeset 1597bfc04df0 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/tryton-env/rev/1597bfc04df0
New changeset 9634941347ec by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/trytond/rev/9634941347ec
New changeset 5829674cd606 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/tryton/rev/5829674cd606
New changeset 9ec4af008e52 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/sao/rev/9ec4af008e52
New changeset ee4b51fe0754 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/timesheet/rev/ee4b51fe0754
New changeset aa519e77b463 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/stock_forecast/rev/aa519e77b463
New changeset a90bc87320bc by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/stock/rev/a90bc87320bc
New changeset 1bfc1e0338e9 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/production/rev/1bfc1e0338e9
New changeset eeabffa928bb by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/party/rev/eeabffa928bb
New changeset cf8abdd8a2a5 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/carrier/rev/cf8abdd8a2a5
New changeset 49fa589a7bd4 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/analytic_account/rev/49fa589a7bd4
New changeset c11a59822c11 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/account_statement/rev/c11a59822c11
New changeset 634df10ed4f1 by Cédric Krier in branch 'default':
Position new record based on order
https://hg.tryton.org/modules/account/rev/634df10ed4f1
review276501003 updated at https://codereview.tryton.org/276501003/#ps266601002
review276501003 updated at https://codereview.tryton.org/276501003/#ps268581002
msg53753 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-30.10:39:03
The problem is that we set a default order on id (to have constant order on reload because database does not have it).
I think we could add support for empty order in the definition (which will still be converted to ASC in ModelSQL). Then the client will ignore those 'id' clauses and fallback to the default behavior. The default behavior can be improved to return -1 when there is a parent and otherwise 0 (so on main tab new record will be added on top and on xxx2many field it will be added at the bottom).
msg53750 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-11-29.22:57:59
Missatge de Cédric Krier <bugs@tryton.org> del dia dv., 29 de nov.
2019 a les 17:16:
>
>
> Cédric Krier <cedric.krier@b2ck.com> added the comment:
>
> Moreover I prefer a solution that "magically" fix most of the existing views (like the current sale, purchase and invoice) than adding a new option that requires to review all the views and allow inconsistent behavior.
> For the special cases, it will always be possible to write an order clause that will provide the desired behavior.

I reviewed the patch and I like the fact that the position where new
records are added are part of the action (instead of the view arch).

However, I don't think this solution magically fixes most existing
views. Parties are still sorted by ID in ascending order, the same
happens with addresses, products, product suppliers or accounts, to
name a few. Almost all of those tend to have thousands of records and
thus will suffer from the same problem.

The only way I see to fix it without having to review all views, is
simply to set ('id', 'DESC') in ModelSQL, although that probably means
that all models that change the _order should be reviewed anyway.

Another possibility is to make the top/bottom choice a Seleciton field
in the Action, set "Top" as default and do not take into account the
order.
review276501003 updated at https://codereview.tryton.org/276501003/#ps260621003
msg53748 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-29.17:16:38
Moreover I prefer a solution that "magically" fix most of the existing views (like the current sale, purchase and invoice) than adding a new option that requires to review all the views and allow inconsistent behavior.
For the special cases, it will always be possible to write an order clause that will provide the desired behavior.
msg53747 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-29.16:52:44
> I'm not specially excited about the proposal. I think we can easily find cases in which you may want the oldest records to be shown at the beginning ('id', 'ASC') and in those cases the user will have a bad UX because newly created records are immediately shown at the end, causing Sao to hang for several seconds or minutes.

The client must put the record at the best place where it will be.

> I would propose to:
>
> - Make "editable" attribute accept only "1" or "0"
> - Add a "new" attribute that accepts "top" or "bottom" (and default to "top" if not set)

Indeed we should change editable to be only boolean and always rely on the order for the position.
msg53746 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-11-29.16:50:15
I'm not specially excited about the proposal. I think we can easily find cases in which you may want the oldest records to be shown at the beginning ('id', 'ASC') and in those cases the user will have a bad UX because newly created records are immediately shown at the end, causing Sao to hang for several seconds or minutes.

I would propose to:

- Make "editable" attribute accept only "1" or "0"
- Add a "new" attribute that accepts "top" or "bottom" (and default to "top" if not set)

This way, non-editable tree views could override the default "top" behaviour if really needed.
review276501003 updated at https://codereview.tryton.org/276501003/#ps252721002
msg53736 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-29.13:37:10
By default if the editable option is not define on a tree view, the clients put new record at the bottom. This may not be the desired behavior for example many documents are ordered by descending dates (and ids) like the sale, invoice and purchase.
Also on sao, when a new record is added at the bottom when the user switch back to the list view, sao has to read all the record to the bottom to display it.

I think we could provide a better default behavior (not perfect but at leaste better) if the server send the default order when the action window does not have one and also on the definition of the xxx2many.
This way the client could search for the clause about the id and decide to put new record at the bottom or on top. This is based on the idea that we always set an order for 'id' that matches the expected behavior of creating new record. And if there are no clause for 'id' we keep the current behavior.
History
Date User Action Args
2020-01-09 22:36:07roundup-botsetmessages: + msg54789
2020-01-09 22:36:04roundup-botsetmessages: + msg54787
2020-01-09 22:36:02roundup-botsetstatus: chatting -> resolved
messages: + msg54785
2020-01-08 19:06:32reviewbotsetstatus: resolved -> chatting
messages: + msg54766
2020-01-08 19:06:31reviewbotsetreviews: 276501003 -> 276501003, 284691003
2019-12-28 18:17:43roundup-botsetmessages: + msg54706
2019-12-28 18:17:39roundup-botsetmessages: + msg54705
2019-12-28 18:17:36roundup-botsetmessages: + msg54704
2019-12-28 18:17:31roundup-botsetmessages: + msg54703
2019-12-28 18:17:27roundup-botsetmessages: + msg54702

Showing 10 items. Show all history (warning: this could be VERY long)