-
Notifications
You must be signed in to change notification settings - Fork 63
AttributeError: 'odoo.modules' has no attribute 'rename_module' when using odoo.upgrade.util.modules.rename_module #272
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 ever. Always use the top-lovel |
We are aware of that and we are working in a way to fix the full name you see there such that we can avoid the confusion. Thanks for reporting this. I'm closing the issue. |
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
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13525 X-original-commit: 541c9d4 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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: fa506a6
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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: fa506a6
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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: fa506a6
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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: fa506a6
fw-bot
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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: fa506a6
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13551 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13547 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13549 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13553 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13547 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
robodoo
pushed a commit
to odoo/documentation
that referenced
this issue
May 26, 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 #13554 X-original-commit: fa506a6 Signed-off-by: Victor Feyens (vfe) <[email protected]> Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Environment:
upgrade-util
Version: [If using a specific version/branch ofupgrade-util
or if it's the one bundled with your Odoo version]Problem Description:
I am attempting to use the
rename_module
function, which is expected to be available viaodoo.upgrade.util.modules
, within an Odoo migration script (def migrate(cr, version):
).I am importing
util
asfrom odoo.upgrade import util
.When calling
util.modules.rename_module(cr, 'old_module_name', 'new_module_name')
, anAttributeError
is raised, indicating that therename_module
attribute is being sought on the standardodoo.modules
module, not withinodoo.upgrade.util.modules
.Steps to Reproduce:
my_module/migrations/<version>/post_rename_module_script.py
).Expected Behavior:
The
rename_module
function fromodoo.upgrade.util.modules
should be successfully called, and the specified module should be renamed in the database.Actual Behavior:
An
AttributeError
is raised:AttributeError: module 'odoo.modules' has no attribute 'rename_module'
It appears that
util.modules
within the script is resolving to the Odoo's coreodoo.modules
(responsible for module registry, graph, etc.) instead of themodules
submodule ofodoo.upgrade.util
.Relevant Documentation:
The official
upgrade-util
documentation (or Odoo developer documentation for upgrades) suggests a structure likeodoo.upgrade.util.modules.some_function(...)
. For instance,odoo.upgrade.util.modules.modules_installed(cr, *modules)
is documented, implying thatutil.modules.FUNCTION_NAME
should be a valid access pattern.Additional Context/Questions:
rename_module
fromodoo.upgrade.util.modules
?odoo.upgrade.util
exposes itsmodules
submodule?env = util.env(cr)
call in the original script (from the screenshot) seems to work, which might suggestutil
itself is imported correctly, but itsmodules
attribute is problematic.Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered: