Tryton - Issues



Title Set order of Function field
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot
Type behavior Components project, trytond
Assigned To ced Keywords review
Reviews 46301002,36111002
View: 46301002, 36111002

Created on 2018-01-27.15:52:28 by ced, last changed by roundup-bot.

New changeset b8105ed94c8c by Cédric Krier in branch 'default':
Order timesheet setters
New changeset 43f7277b81a2 by Cédric Krier in branch 'default':
Add index method to order field set calls
review36111002 updated at
review46301002 updated at
msg39616 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-04-01.01:17:59
Here is review46301002 for trytond and review36111002 for project.
msg39615 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-04-01.01:13:21
Finally, I think the use of depends is not right because there are no direct link between the setter function and the depends that comes from states.
On a second thoughts, we can see that the only need is to be able to define that a setter function should be called after another (or many other).
My idea is to add a method on the ModelStorage class that will return the index order of the call. This method will be used to sort the dictionary keys of the fields to set. By default, this method will return 0. A ModelStorage class may override it to make one field call after another by ensuring to return an index greater for the field than the other field.
msg38082 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-01-27.15:52:28
There is an issue with the two setter 'set_timesheet_available' and 'set_timesheet_date'. When both fields are set in the same create/write call, the 'set_timesheet_date' may be ignored because the 'set_timesheet_available' was not yet called to create the timesheet work.
I do not think the problem is in project module but more a missing feature of the ModelSQL which should have a way to order the calls to set method. I think the Field.set method should be called using the order of the "depends tree". I think that each similar case where setter order is important, the fields depend on each other because mainly the later will have a states depending on the first.
Now, I think the depends order should be solved once in the Model.__post_setup__ to not kill the performance.
Date User Action Args
2018-04-05 19:19:40roundup-botsetmessages: + msg39822
2018-04-05 19:18:56roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg39821
2018-04-01 01:32:35reviewbotsetmessages: + msg39618
2018-04-01 01:32:16reviewbotsetnosy: + reviewbot
messages: + msg39617
2018-04-01 01:18:00cedsetstatus: in-progress -> testing
reviews: 46301002,36111002
messages: + msg39616
keyword: + review
2018-04-01 01:13:22cedsetstatus: unread -> in-progress
assignedto: ced
messages: + msg39615
2018-01-29 10:37:37pokolisetnosy: + pokoli
2018-01-27 15:52:28cedcreate

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