diff options
| author | Nans Lefebvre <len@odoo.com> | 2019-10-15 14:49:25 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-18 09:40:02 +0000 |
| commit | 5efa30c30204336eb6d43119b3f6a55dcb10c9ae (patch) | |
| tree | c6931def8ba76b12b531d4cf121ceb046e7cffee /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 2cab9a8341e3b779ef5c77d665104cc52a5b54cb (diff) | |
[FIX] fields, test_access_rights: get currency field in sudo
This commits fixes user duplication.
Suppose there is a monetary field, with a currency_field that is a related.
When going through model's _create, we do:
`if field.type in ('one2many', 'many2many'):
self.env.cache.set(record, field, ())`
knowing that thse values are false, with the intent to clean them later:
`for record, field in cachetoclear`
However, when setting the scalar values, we go through:
`accessing cache_value = field.convert_to_cache(value, record)`
In the case of the monetary field, this depends on another field value
(the currency_field). If it is a related, we can access its value.
However, at this point, if we check any access rights, we might use the value
of a relational in cache for which the value is incorrectly set to False.
In the case of the user, this is what happens: it inherits its currency_id
from partner, as well as its debit_limit which depends on it.
When the access if checked, company_ids is set to False in cache.
So when going through the rule 'user rule', which checks that the company_ids
intersects with the env.companies.ids, the result is always False.
In some way this is essentially hiding the problem, but the true fix is
probably not feasible in stable.
opw 2086661
closes odoo/odoo#39017
X-original-commit: aa05a9359b42317261c8e7ffcadbeb9fe74dcd58
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
0 files changed, 0 insertions, 0 deletions
