Skip to content
Snippets Groups Projects
Commit 4d501480 authored by Raphael Collet's avatar Raphael Collet
Browse files

[FIX] fields: do not prefetch fields translated with a callable

This is a performance fix.  It avoids the cost of XML/HTML translations
for fields that may not be necessary when prefetching fields on records.
This patch marks such fields as non-prefetchable by default.

The code that changes the attribute `translate` on HTML fields (from
`translate=True` to `translate=html_translate`) has been adapted to
allow the setup of textual fields to mark the field as non-prefetchable.

Jairo Llopis made a comparative benchmark: evaluating `name_get` on
`event.event` records.  The method needs the field `name` and without
the patch, the prefetching mechanism reads the translated HTML field
`description` as well.  This patch speeds up the benchmark from 5800ms
to 800ms (see https://github.com/odoo/odoo/pull/37967#issuecomment-538364011

).

closes odoo/odoo#40651

Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
Co-authored-by: default avatarPedro Baeza <pedro.baeza@tecnativa.com>
Co-authored-by: default avatarJairo Llopis <jairo.llopis@tecnativa.com>
parent 386ead32
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment