odoo/odoo#246333

Created by Framework (ORM), Krzysztof Magusiak (krma)
Merged at 13dc6c9beade323b1001e5267daa7b052a920ee6

Statuses:

label
odoo-dev:saas-19.1-avoid-groupby-krma
head
0fc48434ea09f15416e0dd66a088ecc9f695145b
merged
3 months ago by Framework (ORM), Krzysztof Magusiak (krma)
odoo/odoo
saas-19.1 #246333
saas-19.2
saas-19.3
master #247455

[FIX] orm: avoid groupby on models with custom `_select`

Add a context to know if we are grouppnig. This allows us to stop _search methods which need to search and filter manually all records.

For example, when asking if a field is groupable,
_description_groupable will run a dummy search for many2many fields, for a normal user searching on ir.attachment, it would search for all attachments and try to filter them in memory leading to OOM error.


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr