odoo/odoo#199350

Created by fw-bot
Merged at 3692bd2472175085bd17fe502b8922e7527bc1f1

Statuses:

Linked pull requests
label
odoo-dev:master-master-notifpimp-opti-tde-418133-fw
head
2d3ff4c216206850727733850aa7b178dff88095
merged
7 months ago by Marketing, Thibault Delavallee (tde)
odoo/odoo odoo/enterprise
saas-18.2 #198933 #80120
saas-18.3
saas-18.4
19.0
master #199350 #80192

[FW][IMP] mail, various: improve performance of recipients computation

Since #198095 templates enable suggested recipients fetch when
computing recipients automatically. This made some query counters
higher than before, hence adding some performance tests.

After check, using suggested recipients actually creates partners for
additional recipients. This was not the case with default recipients.
Additional queries come from creating partners notably.

Some performance tests are added then profiled. Some performance
improvements are done in this PR to lessen number of irrelevant queries.
Those are related to: prefetching, partner creation. Some other fiximps
may come in a near future, notably with company_check on properties
fields (under investigation).

See sub commits for more details.

task-4599142

Forward-Port-Of: #198933