Merge branch 'add-option-skip-update-all' into 'main'

[IMP] oow upgrade. Add skip_update as an option in config.yml.

See merge request odoo-openupgrade-wizard/odoo-openupgrade-wizard!111
This commit is contained in:
Rémy Taymans 2025-02-11 13:41:47 +00:00
commit 42bf4f4379
5 changed files with 39 additions and 14 deletions

View File

@ -163,7 +163,11 @@ modules.csv
the classical keys (``db_host``, ``db_port``, etc...) are automatically the classical keys (``db_host``, ``db_port``, etc...) are automatically
autogenerated. autogenerated.
At this step, you should change the autogenerated files. At this step, you should change the autogenerated files. For exemple:
- you can set ``update=False`` to prevents to run an update=all, in the 'regular' steps
(first and last steps). In that case, only SQL queries and python scripts
will be executed during this step.
You can use default files, if you have a very simple odoo instance without custom code, You can use default files, if you have a very simple odoo instance without custom code,
extra repositories, or dependencies... extra repositories, or dependencies...

View File

@ -0,0 +1,4 @@
Add an option ``update`` in the configuration file at migration_step level.
If disabled, the update=all step will be skipped during this step.
That can be interesting to save time, during the first and the last steps of the migration
process (when ``execution_context='regular').

View File

@ -30,18 +30,30 @@ def upgrade(ctx, first_step, last_step, database, with_demo):
) )
for migration_step in migration_steps: for migration_step in migration_steps:
execute_sql_files_pre_migration(ctx, database, migration_step) execute_sql_files_pre_migration(ctx, database, migration_step)
try: if migration_step.get("update", True):
run_odoo( try:
ctx, run_odoo(
migration_step, ctx,
database=database, migration_step,
detached_container=False, database=database,
update="all", detached_container=False,
stop_after_init=True, update="all",
demo=with_demo, stop_after_init=True,
demo=with_demo,
)
except (KeyboardInterrupt, SystemExit):
logger.info("Received Keyboard Interrupt or System Exiting...")
finally:
kill_odoo(ctx, database, migration_step)
elif migration_step.get("execution_context") == "openupgrade":
raise ValueError(
"Incorrect setting 'update: True'"
" and 'execution_context: openupgrade'"
) )
except (KeyboardInterrupt, SystemExit): else:
logger.info("Received Keyboard Interrupt or System Exiting...") logger.info(
finally: "Skip update=all for"
kill_odoo(ctx, database, migration_step) f" step {migration_step.get('complete_name')}"
)
execute_click_odoo_python_files(ctx, database, migration_step) execute_click_odoo_python_files(ctx, database, migration_step)

View File

@ -31,6 +31,9 @@ migration_steps:
version: {{ step['version'] }} version: {{ step['version'] }}
execution_context: {{ step['execution_context'] }} execution_context: {{ step['execution_context'] }}
complete_name: {{ step['complete_name'] }} complete_name: {{ step['complete_name'] }}
{%- if step['execution_context'] == 'regular'%}
update: True
{%- endif %}
{% endfor %} {% endfor %}
workload_settings: workload_settings:

View File

@ -28,6 +28,7 @@ migration_steps:
version: 14.0 version: 14.0
execution_context: regular execution_context: regular
complete_name: step_01__regular__14.0 complete_name: step_01__regular__14.0
update: True
- name: 2 - name: 2
version: 15.0 version: 15.0
@ -38,6 +39,7 @@ migration_steps:
version: 15.0 version: 15.0
execution_context: regular execution_context: regular
complete_name: step_03__regular__15.0 complete_name: step_03__regular__15.0
update: True
workload_settings: workload_settings: