Skip to content

[19.0][MIG] filter_multi_user#1306

Open
samirGuesmi wants to merge 37 commits into
OCA:19.0from
acsone:19.0-mig-filter_multi_user
Open

[19.0][MIG] filter_multi_user#1306
samirGuesmi wants to merge 37 commits into
OCA:19.0from
acsone:19.0-mig-filter_multi_user

Conversation

@samirGuesmi

Copy link
Copy Markdown
Member

No description provided.

LoisRForgeFlow and others added 30 commits June 26, 2026 10:24
Co-authored-by: Simone Orsi <simahawk@users.noreply.github.com>
[UPD] Update filter_multi_user.pot

[UPD] README.rst
[UPD] Update filter_multi_user.pot

[UPD] README.rst
[UPD] Update filter_multi_user.pot

[UPD] README.rst
Currently translated at 100.0% (8 of 8 strings)

Translation: server-ux-14.0/server-ux-14.0-filter_multi_user
Translate-URL: https://translation.odoo-community.org/projects/server-ux-14-0/server-ux-14-0-filter_multi_user/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-16.0/server-ux-16.0-filter_multi_user
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-filter_multi_user/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-16.0/server-ux-16.0-filter_multi_user
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-filter_multi_user/
Currently translated at 100.0% (5 of 5 strings)

Translation: server-ux-16.0/server-ux-16.0-filter_multi_user
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-filter_multi_user/es/
Currently translated at 100.0% (5 of 5 strings)

Translation: server-ux-16.0/server-ux-16.0-filter_multi_user
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-filter_multi_user/it/
@samirGuesmi samirGuesmi force-pushed the 19.0-mig-filter_multi_user branch from 3367b50 to 918290b Compare June 26, 2026 18:11
Comment thread filter_multi_user/models/ir_filters.py Outdated
Comment on lines +23 to +26
@api.constrains("manual_user_ids", "group_ids")
def _compute_user_ids(self):
def _sync_user_ids(self):
for rec in self:
rec.user_ids = rec.manual_user_ids + rec.group_ids.users

@api.model
def get_filters(
self,
model,
action_id=None,
embedded_action_id=None,
embedded_parent_res_id=None,
):
# WARNING: this function overrides the standard one.
# The only change done is in the domain used to search the filters.
action_domain = self._get_action_domain(
action_id, embedded_action_id, embedded_parent_res_id
)
filters = self.search(
action_domain
+ [
("model_id", "=", model),
"|",
"|",
("user_id", "=", self._uid),
("user_ids", "in", self._uid),
"&",
("user_id", "=", False),
("user_ids", "=", False),
]
)
user_context = self.env["res.users"].context_get()
return filters.with_context(**user_context).read(
[
"name",
"is_default",
"domain",
"context",
"user_id",
"sort",
"embedded_action_id",
"embedded_parent_res_id",
]
)
rec.user_ids = rec.manual_user_ids | rec.group_ids.user_ids

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen the usage of api.constrains to change the state of recordset, are you sure it's good idea ?

I would prefer to explicitly make the field compute/store with @api.depends instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to synchronize the field from create() and write() instead

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess api.depends would have updated fields in the UI for better experience but this version seems ok to me

@samirGuesmi samirGuesmi force-pushed the 19.0-mig-filter_multi_user branch from 918290b to 532f6bc Compare July 7, 2026 08:31
@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.