Fix _NamespacePath concatenation error in file_path function

Convert odoo.addons.__path__ to list before concatenation with [root_path]
to fix TypeError when using Python 3.7+ namespace packages.

Error: unsupported operand type(s) for +: '_NamespacePath' and 'list'
Location: odoo/tools/misc.py:169

Added documentation explaining the fix in docs/PATCH_ADDONS_PATH.md

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2025-10-16 16:51:35 +02:00
parent 8c653da57a
commit dd3f495ba4
2 changed files with 49 additions and 1 deletions

View file

@ -166,7 +166,7 @@ def file_path(file_path, filter_ext=('',), env=None):
:raise ValueError: if the file doesn't have one of the supported extensions (`filter_ext`)
"""
root_path = os.path.abspath(config['root_path'])
addons_paths = odoo.addons.__path__ + [root_path]
addons_paths = list(odoo.addons.__path__) + [root_path]
if env and hasattr(env.transaction, '__file_open_tmp_paths'):
addons_paths += env.transaction.__file_open_tmp_paths
is_abs = os.path.isabs(file_path)