diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-02-07 09:55:23 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-02-11 11:05:09 +0000 |
| commit | 12af185961de047f7f9399826f393aff2019c73b (patch) | |
| tree | 089f5a14f0149961e6ef3f6fb7610dd3646b4310 /odoo/api.py | |
| parent | a43f857423cc79322f91cae1f031b3135fb103c1 (diff) | |
[FIX] api, product: search by pricelist
- Activate variants and pricelists
- Go to Product > Products Variants
- Search for anything on the 'Pricelist' filter
A traceback is raised: 'Can only create cache keys from hashable
values...'.
This comes from the following change:
https://github.com/odoo/odoo/blob/4b06fe19fa68255b7982d15e5847da2f6d6209fd/addons/web/static/src/js/views/control_panel/control_panel_model.js#L962
It returns a list instead of a string. Since a list is not hashable, it
causes the issue.
There are not much solutions since the context key `pricelist` can be a
`list` or an `int` (an ID). We force the cache key conversion to a tuple
to avoid the `TypeError` and handle the `list` use case (which was
broken on top of crashing).
opw-2187757
closes odoo/odoo#45064
X-original-commit: ec0a8767143b4c4818418281803c4f52fefa8d2a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'odoo/api.py')
| -rw-r--r-- | odoo/api.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/odoo/api.py b/odoo/api.py index b6a7f1acb8a..ec279a7ceac 100644 --- a/odoo/api.py +++ b/odoo/api.py @@ -725,6 +725,8 @@ class Environment(Mapping): return get_context('active_test', field.context.get('active_test', True)) else: val = get_context(key) + if type(val) is list: + val = tuple(val) try: hash(val) except TypeError: |
