odoo/upgrade-util#320

Created by Upgrade, Carsten Wolff (cawo)

Blocked

label
odoo-dev:master-imp_parallel_iter_browse-cawo
head
94f0b0b61e93fa6a3cf79c679df78690be65f178
odoo/upgrade odoo/upgrade-util
master #8447 missing r+ #320 missing r+

[IMP] orm: parallel iter_browse

[IMP] orm: add optional parallelism to iter_browse.attr()

In some cases, e.g. if it is known that calling a certain method on the model will only trigger inserts or it is clear that updates will be disjunct, such method calls can be done in parallel.

[IMP] orm: add optional parallelism to iter_browse.create()

Like the same support added to __attr__ in the parent commit, this can only be used by callers when it is known that database modifications will be distinct, not causing concurrency issues or side-effects on the results.

create returns an iter_browse object for the caller to browse created records. To support vast amounts of created records in multiprocessing strategy, we process values in a generator and initialize the returned iter_browse object with it. As this requires the caller of create to always consume/iterate the result (otherwise records will not be created), it is not applied to the other strategies as it would break existing API.