-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] base: propagate changes on implied groups update #177301
Conversation
b3a68a6
to
d3f3f65
Compare
Thanks for your review, @kmagusiak ❤️ |
Gentle ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When changing a group on a user we clear the cache (see _get_invalidation_fields
). It is not useful to be specific when changing a group. Just use self.clear_caches()
The code will be simpler and will have the same behavior as when you modify a user (which is actually the case). In addition, some rights may be cached and must be invalidated.
ping @ryv-odoo
Hmmm 🤔 I fail to see how
Am I missing something? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I'm confusing it with future devs. All this code will be deleted no longer be needed.
Could you add a test please.
Steps to reproduce: 1. Add a stored computed field on `res.users` that depends on `groups_id` 2. Add a constraint on `res.users` that depends on `groups_id` 3. Give the user a group 4. Modify the given group and add an implied group Result: - The computed field is not recomputed - The constraint is not checked The reason for this is that the users groups are updated with a raw SQL query, and the ORM is not aware of the changes. This is a regression since 5f12e24. This issue was partially detected and fixed in 459e6dc, but only for a single constraint. This commit makes sure that the ORM properly propagates the changes to computed fields and all constraints, not just the one that was explicitly checked.
bef6175
to
ba8a7d2
Compare
I added the unit tests ✅ Runbot is failing with some unrelated errors, though, with a message saying "This error is already known." FAIL: TestConfigurator.test_01_configurator_flow
Traceback (most recent call last):
File "/data/build/odoo/addons/test_website_modules/tests/test_configurator.py", line 17, in test_01_configurator_flow
self.start_tour('/web#action=website.action_website_configuration', 'configurator_flow', login="admin")
File "/data/build/odoo/odoo/tests/common.py", line 1869, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, **kwargs)
File "/data/build/odoo/odoo/tests/common.py", line 1849, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('configurator_flow')" failed
Tour configurator_flow failed at step click next (trigger: button.o_configurator_show) |
lgfm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robodoo r+
@rco-odoo you may want to rebuild or fix this PR as it has failed CI. |
@ivantodorovich good job, and thanks for your contribution! |
Thanks 🙏🏻! |
Steps to reproduce: 1. Add a stored computed field on `res.users` that depends on `groups_id` 2. Add a constraint on `res.users` that depends on `groups_id` 3. Give the user a group 4. Modify the given group and add an implied group Result: - The computed field is not recomputed - The constraint is not checked The reason for this is that the users groups are updated with a raw SQL query, and the ORM is not aware of the changes. This is a regression since 5f12e24. This issue was partially detected and fixed in 459e6dc, but only for a single constraint. This commit makes sure that the ORM properly propagates the changes to computed fields and all constraints, not just the one that was explicitly checked. closes #177301 Signed-off-by: Raphael Collet <rco@odoo.com>
Steps to reproduce: 1. Add a stored computed field on `res.users` that depends on `groups_id` 2. Add a constraint on `res.users` that depends on `groups_id` 3. Give the user a group 4. Modify the given group and add an implied group Result: - The computed field is not recomputed - The constraint is not checked The reason for this is that the users groups are updated with a raw SQL query, and the ORM is not aware of the changes. This is a regression since 5f12e24. This issue was partially detected and fixed in 459e6dc, but only for a single constraint. This commit makes sure that the ORM properly propagates the changes to computed fields and all constraints, not just the one that was explicitly checked. closes #177301 Signed-off-by: Raphael Collet <rco@odoo.com>
Steps to reproduce:
res.users
that depends ongroups_id
res.users
that depends ongroups_id
Result:
The reason for this is that the users groups are updated with a raw SQL query, and the ORM is not aware of the changes.
This is a regression since 5f12e24. This issue was partially detected and fixed in 459e6dc, but only for a single constraint.
This commit makes sure that the ORM properly propagates the changes to computed fields and all constraints, not just the one that was explicitly checked.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr