-
Notifications
You must be signed in to change notification settings - Fork 62
util.modules import fails in pre-migration of base module #175
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
Comments
Do not use submodules directly, they are internal. Always use |
Wow, so simple. |
aj-fuentes
added a commit
to odoo/documentation
that referenced
this issue
May 23, 2025
The full module path in upgrade utils docs causes confusion for users. See issues odoo/upgrade-util#272 and odoo/upgrade-util#175. All utils we document online should be used via the top-level module --i.e. `util.name` instead of `util.submodule.name` Stripping the module path can be achieved in the configuration with [`add_module_name=False`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-add_module_names) Unfortunately this is a global setting that could affect other parts of Odoo documentation. Thus in current patch we strip the module path from the signature of `odoo.upgrade.util` functions and classes. Technical links: https://www.sphinx-doc.org/en/master/extdev/event_callbacks.html#event-object-description-transform https://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.desc_signature https://github.com/sphinx-doc/sphinx/blob/v4.3.2/sphinx/domains/python.py#L512 https://sphinx-docutils.readthedocs.io/en/latest/docutils.nodes.html#docutils.nodes
aj-fuentes
added a commit
to odoo/documentation
that referenced
this issue
May 23, 2025
The full module path in upgrade utils docs causes confusion for users. See issues odoo/upgrade-util#272 and odoo/upgrade-util#175. All utils we document online should be used via the top-level module --i.e. `util.name` instead of `util.submodule.name` Stripping the module path can be achieved in the configuration with [`add_module_name=False`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-add_module_names) Unfortunately this is a global setting that could affect other parts of Odoo documentation. Thus in current patch we strip the module path from the signature of `odoo.upgrade.util` functions and classes. Technical links: https://www.sphinx-doc.org/en/master/extdev/event_callbacks.html#event-object-description-transform https://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.desc_signature https://github.com/sphinx-doc/sphinx/blob/v4.3.2/sphinx/domains/python.py#L512 https://sphinx-docutils.readthedocs.io/en/latest/docutils.nodes.html#docutils.nodes
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 23, 2025
The full module path in upgrade utils docs causes confusion for users. See issues odoo/upgrade-util#272 and odoo/upgrade-util#175. All utils we document online should be used via the top-level module --i.e. `util.name` instead of `util.submodule.name` Stripping the module path can be achieved in the configuration with [`add_module_name=False`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-add_module_names) Unfortunately this is a global setting that could affect other parts of Odoo documentation. Thus in current patch we strip the module path from the signature of `odoo.upgrade.util` functions and classes. Technical links: https://www.sphinx-doc.org/en/master/extdev/event_callbacks.html#event-object-description-transform https://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.desc_signature https://github.com/sphinx-doc/sphinx/blob/v4.3.2/sphinx/domains/python.py#L512 https://sphinx-docutils.readthedocs.io/en/latest/docutils.nodes.html#docutils.nodes closes #13519 Signed-off-by: Victor Feyens (vfe) <[email protected]>
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 23, 2025
The full module path in upgrade utils docs causes confusion for users. See issues odoo/upgrade-util#272 and odoo/upgrade-util#175. All utils we document online should be used via the top-level module --i.e. `util.name` instead of `util.submodule.name` Stripping the module path can be achieved in the configuration with [`add_module_name=False`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-add_module_names) Unfortunately this is a global setting that could affect other parts of Odoo documentation. Thus in current patch we strip the module path from the signature of `odoo.upgrade.util` functions and classes. Technical links: https://www.sphinx-doc.org/en/master/extdev/event_callbacks.html#event-object-description-transform https://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.desc_signature https://github.com/sphinx-doc/sphinx/blob/v4.3.2/sphinx/domains/python.py#L512 https://sphinx-docutils.readthedocs.io/en/latest/docutils.nodes.html#docutils.nodes X-original-commit: 541c9d4
aj-fuentes
added a commit
to odoo/documentation
that referenced
this issue
May 23, 2025
The full module path in upgrade utils docs causes confusion for users. See issues odoo/upgrade-util#272 and odoo/upgrade-util#175. All utils we document online should be used via the top-level module --i.e. `util.name` instead of `util.submodule.name` Stripping the module path can be achieved in the configuration with [`add_module_name=False`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-add_module_names) Unfortunately this is a global setting that could affect other parts of Odoo documentation. Thus in current patch we strip the module path from the signature of `odoo.upgrade.util` functions and classes. Technical links: https://www.sphinx-doc.org/en/master/extdev/event_callbacks.html#event-object-description-transform https://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.desc_signature https://github.com/sphinx-doc/sphinx/blob/v4.3.2/sphinx/domains/python.py#L512 https://sphinx-docutils.readthedocs.io/en/latest/docutils.nodes.html#docutils.nodes X-original-commit: 541c9d4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
When upgrading to 17.0 there is new dependency of custom module that I want to install in pre-migration of base module.
But
util.modules
is not imported correctly in pre- migration but works in post-.util.modules.module_installed(cr, 'my_custom_module')
gives following errorAttributeError: module 'odoo.modules' has no attribute 'module_installed'
My setup is following:
After upgrading the database from 15.0 to 17.0 via
python <(curl -s https://upgrade.odoo.com/upgrade) test -d <your db name> -t <target version>
It is restored to continue migration of custom modules.
Everything happens inside docker container.
Odoo is installed at
/usr/lib/python3/dist-packages/odoo
Upgrade util is installed at
/usr/local/lib/python3.10/dist-packages/odoo/upgrade
viasudo -H pip3 install --upgrade git+https://github.com/odoo/upgrade-util@master
Custom upgrade script is located at
/mnt/extra-addons/upgrades/base/16.0.1.3/pre-install_new_deps.py
With psql I reset base version (as it is 17.0.1.3 after upgrade.odoo.com) to trigger our upgrade scripts
And start odoo
UPG_AUTOINSTALL='all' odoo -u all -d odoo --upgrade-path=/usr/local/lib/python3.10/dist-packages/odoo/upgrade,/mnt/extra-addons/upgrades --stop-after-init
If I set the breakpoint at upgrade script and check util there it can be seen that modules attribute is imported from odoo modules not from util so the script fails.
However it works in
base/0.0.0/post-install_new_deps.py
for some reason but it's too late for modules operations.The text was updated successfully, but these errors were encountered: