Created on 2014-02-22.13:03:28 by albertca, last changed 18 months ago by ced.
Querying the server to make the sum may be too expensive but I think we need a solution that allows the user to get the information if he wants. A possible solution would be to have each sum computed if the record included are loaded (like review3721002) but also allow the user to click on the sum to force the load and the computation. This way the computation of large sets is on demand.
There is need for an immediate solution, even stop-gap as Albert indicates. It is unacceptable to select lines in a client without feedback on the amounts involved ... absolutely crucial when reconciling lines. Is it possible to at least update the initial proposal with a patchset compatible with current 'develop' branch?
I don't agree. In Tryton, we always try to provide the best solution so it is better to wait until the right/best solution is developped.
I think we could commit this solution as it is an improvement over existing behaviour and think about the other proposals as possible future improvements.
The problem I see by asking the server is that it can be very annoying in slow networks that simply selecting records makes a server call. Also making it work on client and server and making it flexible can be complicated or you'd need to support a set of operations such as sum & avg only.
Don't understand what you mean by "allow the view to call a custom per model method".
I'm not sure about the API, I find it not very powerful. I'm wondering if we really need to add a new method or just allow the view to call a custom per model method.
What Cédric says makes sense for me, so why not adding a server function that computes the aggreate like: def aggregate(cls, ids, fields, type='sum'): that should return a dict with the fields in the keys and the computed aggregate as value.
I'm wondering if we should not try to implement a always workable solution. I think we could try to design an API to get the server computes the sum (or any other aggregate) based on a list of ids. So when the client has all the records loaded, it does the computation and when it is not it asks to the server.
Tryton client only shows totals of selected records if all records are loaded. This is an unnecessary limitation. The following review shows sum of selected and loaded records. review3721002
|2020-04-02 12:49:06||ced||set||title: tryton: Show sum of all loaded selected records -> Show sum of all loaded selected records|
|2019-09-25 14:56:37||ced||set||component: + tryton, sao|
|2019-09-25 14:56:30||ced||set||priority: wish -> feature|
|2019-09-25 14:56:26||ced||set||messages: + msg52038|
|2019-05-06 21:53:55||ced||link||issue8335 superseder|
messages: + msg37042
|2017-11-20 19:44:25||ced||link||issue6955 superseder|
|2017-11-20 19:43:44||ced||link||issue2515 superseder|
|2014-02-27 22:09:04||ced||set||messages: + msg15799|
|2014-02-27 19:12:33||albertca||set||messages: + msg15798|
Showing 10 items. Show all history (warning: this could be VERY long)