Skip to content
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

Trying to migrate from 16.0 to 18.0 im getting "unsupported operand type(s)" error #122

Open
BT-crodriguez opened this issue Nov 27, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@BT-crodriguez
Copy link

BT-crodriguez commented Nov 27, 2024

Module

odoo-module-migrator

Describe the bug

running the following command

 python -m odoo_module_migrate -d $path_to_my_repo -m $my_module -i 16.0 -t 18.0 -nc -npc

Returns this error

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/__main__.py", line 163, in <module>
    main(sys.argv[1:])
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/__main__.py", line 143, in main
    migration = Migration(
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/migration.py", line 109, in __init__
    self._get_migration_scripts()
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/migration.py", line 222, in _get_migration_scripts
    self._migration_scripts.extend(self._load_migration_script(full_name))
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/migration.py", line 173, in _load_migration_script
    module = importlib.import_module(full_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/migration_scripts/migrate_160_170.py", line 14, in <module>
    class AbstractVisitor(ast.NodeVisitor):
  File "/home/bt-crodriguez/odoo-module-migrator/odoo_module_migrate/migration_scripts/migrate_160_170.py", line 35, in AbstractVisitor
    def add_change(self, old_node: ast.AST, new_node: ast.AST | str):
TypeError: unsupported operand type(s) for |: 'type' and 'type'

To Reproduce

Affected versions:
Developer mode

Steps to reproduce the behavior:
Follow steps from https://github.com/OCA/odoo-module-migrator/blob/master/DEVELOP.rst

# Pull Code
git clone https://github.com/grap/odoo-module-migrator
cd odoo-module-migrator

# Create virtual env and activate it
virtualenv env --python=python3
. ./env/bin/activate

# Install dependencies
pip3 install -r requirements.txt


python -m odoo_module_migrate -d $path_to_my_repo -m $my_module -i 16.0 -t 18.0 -nc -npc

Expected behavior
No error appears or at least explains where it's failing exactly

Additional context
Ubuntu 20.04.6 LTS, python3.8

@BT-crodriguez BT-crodriguez added the bug Something isn't working label Nov 27, 2024
@nilshamerlinck
Copy link

I see you are using python3.8, can you try with a >=3.10?

@BT-crodriguez
Copy link
Author

@nilshamerlinck I tried with 3.12.7 and it worked, i didnt see this change of requirements anywhere and it's not on the develop.rst...

Thanks for the help

@sebalix
Copy link

sebalix commented Nov 29, 2024

I had the same issue when trying with Python 3.8. Upgrading the Python requirement would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants