diff options
| author | Julien Castiaux <juc@odoo.com> | 2019-08-12 15:14:40 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2019-08-19 09:04:09 +0000 |
| commit | 855447fc77fdbe2972be043b7ba9131567d21b9f (patch) | |
| tree | 3862516f0fbd7ef69e4f1c1a6a4779240ec7d972 /odoo/addons/test_access_rights/ir.model.access.csv | |
| parent | 0458337bc362b4ecc020fd95a5896dc9d394322b (diff) | |
[FIX] ir_rule: invalid user context propagation
Create two models, `object` and `category`. The object have a Many2One
to the category. Override the `search` on the category so it returns a
subset of the records if a context key is present. Create an IR Rule on
object with the following pseudo-domain: `categ_id in category.search([])`.
Search on object with the context key present. Even if the context
should only be applied to category, it is applied to object too thus
there are some object missing.
When evaluating the domain of IR Rules, the current user is propagated
with the current environment context. API calls triggered by the domain
are called with the given context, possibly populating the cache with
different records than it would normally does without the context (i.e.
at `addons/point_of_sale/models/account_journal.py#L19-L23`). Following
requests do use that invalid cache thus return invalid results.
Forcing an empty context on the user used during the evaluation of the
context ensures the IR Rules are working as they should and is
future-proof (cf `load_company` v13 context key)
opw-2041667
closes #35123
closes #35125
closes odoo/odoo#35667
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Co-authored-by: Hugo Adan <hugo@vauxoo.com>
Diffstat (limited to 'odoo/addons/test_access_rights/ir.model.access.csv')
| -rw-r--r-- | odoo/addons/test_access_rights/ir.model.access.csv | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/addons/test_access_rights/ir.model.access.csv b/odoo/addons/test_access_rights/ir.model.access.csv index eda40f960d9..4bbc5b37c59 100644 --- a/odoo/addons/test_access_rights/ir.model.access.csv +++ b/odoo/addons/test_access_rights/ir.model.access.csv @@ -1,3 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_test_access_right_some_obj,access_test_access_right_some_obj,model_test_access_right_some_obj,,1,1,1,1 access_test_access_right_container,access_test_access_right_container,model_test_access_right_container,,1,1,1,1 +access_test_access_right_obj_categ,access_test_access_right_obj_categ,model_test_access_right_obj_categ,,1,1,1,1 |
