[19.0][MIG] filter_multi_user#1306
Open
samirGuesmi wants to merge 37 commits into
Open
Conversation
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/
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/tr/
3367b50 to
918290b
Compare
petrus-v
reviewed
Jul 2, 2026
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 |
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
I've changed it to synchronize the field from create() and write() instead
There was a problem hiding this comment.
I guess api.depends would have updated fields in the UI for better experience but this version seems ok to me
918290b to
532f6bc
Compare
petrus-v
approved these changes
Jul 7, 2026
lmarion-source
approved these changes
Jul 13, 2026
Contributor
|
This PR has the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.