diff --git a/odoo_openupgrade_wizard/cli/cli_install_from_csv.py b/odoo_openupgrade_wizard/cli/cli_install_from_csv.py index 1d06658..40eb2e5 100644 --- a/odoo_openupgrade_wizard/cli/cli_install_from_csv.py +++ b/odoo_openupgrade_wizard/cli/cli_install_from_csv.py @@ -3,6 +3,7 @@ from loguru import logger from odoo_openupgrade_wizard.cli.cli_options import ( database_option, + demo_option, get_migration_step_from_options, ) from odoo_openupgrade_wizard.tools.tools_odoo import ( @@ -16,11 +17,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database @click.command() @database_option -@click.option( - "--with-demo/--whitout-demo", - default=True, - help="Create database with or without demo data.", -) +@demo_option @click.pass_context def install_from_csv(ctx, database, with_demo): migration_step = get_migration_step_from_options(ctx, 1) diff --git a/odoo_openupgrade_wizard/cli/cli_options.py b/odoo_openupgrade_wizard/cli/cli_options.py index 7efcb19..4e46ab7 100644 --- a/odoo_openupgrade_wizard/cli/cli_options.py +++ b/odoo_openupgrade_wizard/cli/cli_options.py @@ -44,6 +44,15 @@ def last_step_option(function): return function +def demo_option(function): + function = click.option( + "--with-demo/--without-demo", + default=False, + help="Create database with or without demo data.", + )(function) + return function + + def database_option(function): function = click.option( "-d", diff --git a/odoo_openupgrade_wizard/cli/cli_run.py b/odoo_openupgrade_wizard/cli/cli_run.py index 6d06dc1..8c507a6 100644 --- a/odoo_openupgrade_wizard/cli/cli_run.py +++ b/odoo_openupgrade_wizard/cli/cli_run.py @@ -3,6 +3,7 @@ from loguru import logger from odoo_openupgrade_wizard.cli.cli_options import ( database_option, + demo_option, get_migration_step_from_options, step_option, ) @@ -13,6 +14,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database @click.command() @step_option @database_option +@demo_option @click.option( "--stop-after-init", is_flag=True, @@ -27,6 +29,12 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database type=str, help="List of modules to install. Equivalent to -i odoo options.", ) +@click.option( + "-u", + "--update-modules", + type=str, + help="List of modules to update. Equivalent to -u odoo options.", +) @click.option( "-e", "--execution-context", @@ -36,7 +44,16 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database " Let empty to use the defaut execution of the migration step.", ) @click.pass_context -def run(ctx, step, database, stop_after_init, init_modules, execution_context): +def run( + ctx, + step, + database, + with_demo, + stop_after_init, + init_modules, + update_modules, + execution_context, +): migration_step = get_migration_step_from_options(ctx, step) ensure_database(ctx, database, state="present") try: @@ -46,7 +63,9 @@ def run(ctx, step, database, stop_after_init, init_modules, execution_context): database=database, detached_container=not stop_after_init, init=init_modules, + update=update_modules, stop_after_init=stop_after_init, + demo=with_demo, execution_context=execution_context, ) if not stop_after_init: diff --git a/odoo_openupgrade_wizard/cli/cli_upgrade.py b/odoo_openupgrade_wizard/cli/cli_upgrade.py index 4989abb..55f0481 100644 --- a/odoo_openupgrade_wizard/cli/cli_upgrade.py +++ b/odoo_openupgrade_wizard/cli/cli_upgrade.py @@ -3,6 +3,7 @@ from loguru import logger from odoo_openupgrade_wizard.cli.cli_options import ( database_option_required, + demo_option, first_step_option, get_migration_steps_from_options, last_step_option, @@ -21,8 +22,9 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ( @first_step_option @last_step_option @database_option_required +@demo_option @click.pass_context -def upgrade(ctx, first_step, last_step, database): +def upgrade(ctx, first_step, last_step, database, with_demo): migration_steps = get_migration_steps_from_options( ctx, first_step, last_step ) @@ -36,6 +38,7 @@ def upgrade(ctx, first_step, last_step, database): detached_container=False, update="all", stop_after_init=True, + demo=with_demo, ) except (KeyboardInterrupt, SystemExit): logger.info("Received Keyboard Interrupt or System Exiting...")