Daily updates from Odoo
Monday, March 9, 2020
1 change · master
Code cleanup and technical improvements
This update simplifies how messages are prepared for display by relying on newer platform caching instead of extra data lookups. It is intended to keep the same behavior while reducing internal complexity and protecting message performance with added tests.
Original PR description
Remove aggregation from `message_format `and `_message_read_dict_postprocess`. There should be no functional change in this PR. Purpose ======= The existing code working with "tree" for aggregation…
Remove aggregation from `message_format `and `_message_read_dict_postprocess`. There should be no functional change in this PR. Purpose ======= The existing code working with "tree" for aggregation and doing explicit "read" or "search" for related fields does not seem necessary since the ORM of v13. Considering that it adds complexity to the method, if its original purpose is not necessary anymore, it would be better to change it. The notable changes of the ORM that would justify this task are: - single cache, shared between current user and sudo (which is called a lot in those methods and might explain why the "tree" mechanism was put in place originally) - m2o and o2m being kept consistent with each other, which allows accessing o2m through fields directly (instead of having to use "search" to ensure getting consistent data) Explanation =========== Doing "read" or "search" could be counter-productive if the data are already in cache because using those methods will lead to a query no matter what. The ideal way is to simply access the fields through the records. As for the "tree" and aggregation in general, the prefetch is automatically taking care of that when iterating. task-2180311