Skip to content

[19.0][FIX] base_comment_template: fix model_ids search - #1216

Open
Ricardoalso wants to merge 1 commit into
OCA:19.0from
camptocamp:19.0-fix-base_comment_template-search_model_ids
Open

Ricardoalso wants to merge 1 commit into
OCA:19.0from
camptocamp:19.0-fix-base_comment_template-search_model_ids

Conversation

@Ricardoalso

Copy link
Copy Markdown
Contributor

In 19.0, the domain optimizer rewrites conditions on model_ids before calling _search_model_ids: a string value becomes an 'any' on display_name, and the 'any' sub-domain is first searched on ir.model as the current user. ir.model is only readable by the "Access Rights" group, so any other user filtering on model_ids (e.g. the purchase or sale "Document Comments" menus) got an AccessError. The search method also never matched, since it compared a Domain to technical names.

Set bypass_search_access on model_ids and handle the 'any'/'in' operators: resolve the ir.model records as superuser and match their technical names against the stored models field. Keep supporting the direct _search_model_ids("in", ) calls from comment.template.

In 19.0, the domain optimizer rewrites conditions on model_ids before
calling _search_model_ids: a string value becomes an 'any' on
display_name, and the 'any' sub-domain is first searched on ir.model as
the current user. ir.model is only readable by the "Access Rights"
group, so any other user filtering on model_ids (e.g. the purchase or
sale "Document Comments" menus) got an AccessError. The search method
also never matched, since it compared a Domain to technical names.

Set bypass_search_access on model_ids and handle the 'any'/'in'
operators: resolve the ir.model records as superuser and match their
technical names against the stored `models` field. Keep supporting the
direct _search_model_ids("in", <model name>) calls from
comment.template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_comment_template Module base_comment_template series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants