-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[16.0][IMP] module_auto_update: auto_upgrade command #3487
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
Open
fkantelberg
wants to merge
1
commit into
OCA:16.0
Choose a base branch
from
initOS:16.0-imp-module_auto_update_command
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
|
||
| from . import models | ||
| from . import cli, models | ||
| from .hooks import uninstall_hook |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # © 2025 initOS GmbH | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| from . import auto_update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # © 2025 initOS GmbH | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| import odoo | ||
| from odoo import api | ||
| from odoo.cli.shell import Shell | ||
| from odoo.tools import config | ||
|
|
||
|
|
||
| class ModuleAutoUpgrade(Shell): | ||
| """Run auto upgrade""" | ||
|
|
||
| name = "auto_update" | ||
|
|
||
| def run(self, args): | ||
| self.init(args) | ||
| registry = odoo.registry(config["db_name"]) | ||
| with registry.cursor() as cr: | ||
| uid = odoo.SUPERUSER_ID | ||
| # Disabling prefetching of fields here because new fields for | ||
| # res.partner and res.users already exist in the python structures | ||
| # but aren't available in the database yet and would cause exception here | ||
| # This is different from invoking a python shell | ||
| ctx = ( | ||
| odoo.api.Environment(cr, uid, {})["res.users"] | ||
| .with_context(prefetch_fields=False) | ||
| .context_get() | ||
| ) | ||
|
|
||
| env = api.Environment(cr, uid, ctx) | ||
| env["ir.module.module"].upgrade_changed_checksum( | ||
| overwrite_existing_translations=config[ | ||
| "overwrite_existing_translations" | ||
| ], | ||
| ) | ||
| return 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,10 +8,11 @@ | |
|
|
||
| /* | ||
| :Author: David Goodger ([email protected]) | ||
| :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
| :Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ | ||
| :Copyright: This stylesheet has been placed in the public domain. | ||
|
|
||
| Default cascading style sheet for the HTML output of Docutils. | ||
| Despite the name, some widely supported CSS2 features are used. | ||
|
|
||
| See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
| customize this style sheet. | ||
|
|
@@ -274,7 +275,7 @@ | |
| margin-left: 2em ; | ||
| margin-right: 2em } | ||
|
|
||
| pre.code .ln { color: grey; } /* line numbers */ | ||
| pre.code .ln { color: gray; } /* line numbers */ | ||
| pre.code, code { background-color: #eeeeee } | ||
| pre.code .comment, code .comment { color: #5C6576 } | ||
| pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } | ||
|
|
@@ -300,7 +301,7 @@ | |
| span.pre { | ||
| white-space: pre } | ||
|
|
||
| span.problematic { | ||
| span.problematic, pre.problematic { | ||
| color: red } | ||
|
|
||
| span.section-subtitle { | ||
|
|
@@ -419,6 +420,12 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> | |
| <pre class="code python literal-block"> | ||
| <span class="n">env</span><span class="p">[</span><span class="s1">'ir.module.module'</span><span class="p">]</span><span class="o">.</span><span class="n">upgrade_changed_checksum</span><span class="p">()</span> | ||
| </pre> | ||
| <p>For integration in toolchains the upgrade mechanism can also be invoked using the Odoo cli command <tt class="docutils literal">auto_update</tt>. The <cite>–addons-path=</cite> is required as first argument:</p> | ||
| <pre class="code bash literal-block"> | ||
| odoo-bin<span class="w"> </span>--addons-path<span class="o">=</span>...<span class="w"> </span>auto_update<span class="w"> </span>-d<span class="w"> </span>odoo<span class="w"> | ||
| </span><span class="c1"># or | ||
| </span>odoo-bin<span class="w"> </span>--addons-path<span class="o">=</span>...<span class="w"> </span>auto_update<span class="w"> </span>-c<span class="w"> </span>path/to/odoo.cfg | ||
| </pre> | ||
| </div> | ||
| <div class="section" id="bug-tracker"> | ||
| <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1> | ||
|
|
@@ -453,7 +460,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2> | |
| <div class="section" id="maintainers"> | ||
| <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2> | ||
| <p>This module is maintained by the OCA.</p> | ||
| <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> | ||
| <a class="reference external image-reference" href="https://odoo-community.org"> | ||
| <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /> | ||
| </a> | ||
| <p>OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use.</p> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.