fixup! [IMP] oow upgrade. Add skip_update as an option in config.yml. (migration_step option). If enabled, in this step, the update all will be skipped, and only pre-migration (SQL) and post-migration (python script) will be executed. This is interesting: - for the first step, if your production is up-to-date, to save time. - for the last step, in recent version (since V14), where openupgrade doesn't contain odoo code. In that case, you should be sure that all your migration is OK, because in openupgrade context, some errors are just ignored. Use this option with caution.
This commit is contained in:
parent
4fc7056932
commit
bfde1ddc1f
|
|
@ -164,7 +164,7 @@ modules.csv
|
||||||
autogenerated.
|
autogenerated.
|
||||||
|
|
||||||
At this step, you should change the autogenerated files. For exemple:
|
At this step, you should change the autogenerated files. For exemple:
|
||||||
- you can set ``skip_update=True`` to prevents to run an update=all, in the 'regular' steps
|
- 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
|
(first and last steps). In that case, only SQL queries and python scripts
|
||||||
will be executed during this step.
|
will be executed during this step.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
Add an option ``skip_update`` in the configuration file at migration_step level.
|
Add an option ``update`` in the configuration file at migration_step level.
|
||||||
If enabled, the update=all step will be skipped during this step.
|
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
|
That can be interesting to save time, during the first and the last steps of the migration
|
||||||
process (when ``execution_context='regular').
|
process (when ``execution_context='regular').
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ 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)
|
||||||
if not migration_step.get("skip_update", False):
|
if migration_step.get("update", True):
|
||||||
try:
|
try:
|
||||||
run_odoo(
|
run_odoo(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
@ -46,13 +46,14 @@ def upgrade(ctx, first_step, last_step, database, with_demo):
|
||||||
finally:
|
finally:
|
||||||
kill_odoo(ctx, database, migration_step)
|
kill_odoo(ctx, database, migration_step)
|
||||||
elif migration_step.get("execution_context") == "openupgrade":
|
elif migration_step.get("execution_context") == "openupgrade":
|
||||||
logger.warning(
|
raise ValueError(
|
||||||
"Incorrect setting skip_update = True"
|
"Incorrect setting 'update: True'"
|
||||||
" and execution_context = 'openupgrade'..."
|
" and 'execution_context: openupgrade'"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Skip update all for version {migration_step.get('version')}."
|
"Skip update=all for"
|
||||||
|
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)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ migration_steps:
|
||||||
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'%}
|
{%- if step['execution_context'] == 'regular'%}
|
||||||
skip_update: False
|
update: True
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +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
|
||||||
skip_update: False
|
update: True
|
||||||
|
|
||||||
- name: 2
|
- name: 2
|
||||||
version: 15.0
|
version: 15.0
|
||||||
|
|
@ -39,7 +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
|
||||||
skip_update: False
|
update: True
|
||||||
|
|
||||||
|
|
||||||
workload_settings:
|
workload_settings:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user