Issue 10936

Title
Comparing Balance or Income Statement not working in 6.2
Priority
bug
Status
resolved
Nosy list
ced, edbo, nicoe, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2021-11-08.19:34:50 by edbo, last changed 1 week ago by roundup-bot.

Messages

New changeset 065cb0e9cdbf by Cédric Krier in branch 'default':
Create record by XML for test with readonly transaction
https://hg.tryton.org/tryton-env/rev/065cb0e9cdbf
New changeset 8cd6dd7196eb by Cédric Krier in branch 'default':
Create record by XML for test with readonly transaction
https://hg.tryton.org/trytond/rev/8cd6dd7196eb
New changeset c2ea6e5aae39 by Cédric Krier in branch 'default':
Cache Function field getter without context in readonly transactions
https://hg.tryton.org/tryton-env/rev/c2ea6e5aae39

New changeset cec633cfdf8f by Cédric Krier in branch 'default':
Fill local cache of Function field instances with values
https://hg.tryton.org/tryton-env/rev/cec633cfdf8f
New changeset 3193180548e8 by Cédric Krier in branch 'default':
Cache Function field getter without context in readonly transactions
https://hg.tryton.org/trytond/rev/3193180548e8

New changeset 82b1408ceaa2 by Cédric Krier in branch 'default':
Fill local cache of Function field instances with values
https://hg.tryton.org/trytond/rev/82b1408ceaa2
Author: [hidden] (edbo)
Date: 2021-11-15.14:31:16

I have tested review367781002 and it restores the behavior from the previous versions. I tested this one because it's closed to the originating issue [issue10491](issue10491)

New changeset 9a06b013733b by Cédric Krier in branch '6.2':
Do not store in global cache Function field
https://hg.tryton.org/trytond/rev/9a06b013733b
New changeset 02adfd3a00b9 by Cédric Krier in branch 'default':
Do not store in global cache Function field
https://hg.tryton.org/tryton-env/rev/02adfd3a00b9
New changeset 055efc4c622f by Cédric Krier in branch 'default':
Do not store in global cache Function field
https://hg.tryton.org/trytond/rev/055efc4c622f
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-11-09.13:53:32

Here are the two new implementations and the removal of the feature in 6.2. I updated the changelog in order to not create confusion about the actual feature implemented in this series.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-11-09.11:52:38

I think we must remove the feature in 6.2 series as it can not work by design and re-implementing it will need to change the API (see the following proposal).

So in order to keep the performance improvement I see two possibilities (which can both be implemented) which restore partially the initial goal:

  • add an attribute on Function field which define if the getter function depends on the context or not. If it does not depend we can store the result in the global cache in readonly transaction. (I could not find any other method than a flag, I tried to detect usage of context but there are two much side-effect). Also in this case the Function field must reset the context (with only the cache keys of transaction) to ensure that the result is independent of it (and to detect wrong configuration).
  • we fill the local cache of the instance in Function.get with the values already read. This can only be done for base python type like numeric or string but not with instances. This can be done also on non-readonly transaction but it will improve the performance only for the current instances (not if the value is reused by an indirect instance).
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-11-08.19:52:29

This is linked to issue10491. Indeed storing the in the cache the result of function field that depends of the context does not work because transactional cache is only depending on few contextual parameters.

Author: [hidden] (edbo)
Date: 2021-11-08.19:46:00

It seems like the data is taken from the comparing part.

Author: [hidden] (edbo)
Date: 2021-11-08.19:34:50

I upgraded today to version 6.2 and walked into this problem. You can compare the Balance or Income Statement with an earlier 'version' using the context. But changing the context and refreshing the data does not update the amounts anymore and they stay the same.

History
Date User Action Args
2021-11-28 14:31:55roundup-botsetmessages: + msg71905
2021-11-28 14:31:51roundup-botsetmessages: + msg71904
2021-11-28 13:41:10roundup-botsetmessages: + msg71894
2021-11-28 13:40:56roundup-botsetmessages: + msg71893
status: chatting -> resolved
2021-11-15 14:31:16edbosetmessages: + msg71674
2021-11-15 00:28:39reviewbotsetmessages: + msg71661
2021-11-15 00:28:31reviewbotsetmessages: + msg71660
status: resolved -> chatting
2021-11-15 00:20:18roundup-botsetkeyword: - backport
messages: + msg71659
status: testing -> resolved
2021-11-14 23:55:24cedsetkeyword: + backport
status: resolved -> testing
2021-11-14 23:55:07roundup-botsetmessages: + msg71655

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