From 0b3f94f9ece0d70017a9caa645b76da9b7a426b1 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 1 Oct 2024 11:13:07 +0200 Subject: [PATCH] [ADD] documentation for OpenUpgrade manager. how to create reference database. replace old wiki. see https://github.com/grap/openupgrade_wiki_backup/blob/master/How-to-create-a-reference-database.md --- docsource/100_maintain_repository.rst | 21 +++++++++- .../create_reference_database.sh | 42 +++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 docsource/maintainer_scripts/create_reference_database.sh diff --git a/docsource/100_maintain_repository.rst b/docsource/100_maintain_repository.rst index 6f86b2b9e7f4..9eb63346709a 100644 --- a/docsource/100_maintain_repository.rst +++ b/docsource/100_maintain_repository.rst @@ -11,6 +11,25 @@ Set up the branch for a new Odoo release Finally, ``git push`` the branch on your fork, and make a pull request against OCA/$NEW branch. +Create a Reference Database +--------------------------- + +To run a test migration, the Github `Test` workflow downloads a preinstalled database of the previous version +from https://github.com/OCA/OpenUpgrade/releases/tag/databases. +This database has all Odoo core modules installed with demo data. + +* Checkout a clean Odoo up-to-date base code +* Make sure your addons_path only contains odoo repo, (if it contains OCA / custom repo) the modules will be installed. +* Odoo version 11.0 may require this patch: https://github.com/odoo/odoo/pull/28620 +* Generate the database + +.. literalinclude:: maintainer_scripts/create_reference_database.sh + :language: shell + +* Upload the database ``.psql`` file present in the ``/tmp/`` folder [here](https://github.com/OCA/OpenUpgrade/releases/tag/databases). + +To check if all is ok, you should migrate the ``openupgrade_scripts`` module (first) and then the ``openupgrade_framework`` module, and check if the CI is OK. + Manual changes -------------- @@ -24,8 +43,6 @@ Manual changes * In the ``OpenUpgrade``/``documentation`` branch, add a new line in ``build_openupgrade_docs``. -* Push a test database for the old release to Github (see https://github.com/OCA/OpenUpgrade/wiki/How-to-create-a-reference-database) - * Execute the technical migration of ``openupgrade_framework``. * Check files in .github/workflows for any required changes. diff --git a/docsource/maintainer_scripts/create_reference_database.sh b/docsource/maintainer_scripts/create_reference_database.sh new file mode 100644 index 000000000000..847f3190d8bd --- /dev/null +++ b/docsource/maintainer_scripts/create_reference_database.sh @@ -0,0 +1,42 @@ +# Note: In that script, we generate a 17.0 database, +# that will be used by the OpenUpgrade CI of the 18.0 branch. + +# Configuration +export VERSION=17.0 + +# Install account module first to ensure that the chart of accounts of l10n_generic_coa +# is installed instead of the chart of accounts of the first localization module that is encountered. +odoo-bin -d $VERSION -i account --stop-after-init --without-demo= + +# Mark all interesting modules as installable +echo "update ir_module_module set state = 'uninstallable' where name like 'test%' or name like 'hw_%';" | psql $VERSION +echo "update ir_module_module set state = 'to install', demo=true where state = 'uninstalled';" | psql $VERSION + +# Install all modules +odoo-bin -d $VERSION -i dummy --stop-after-init --without-demo= + +# Note: Installation could fail because install modules sometime requires extra python libraries +# that are not present in the requirements.txt file. For exemple, install ``l10n_eg_edi_eta`` +# requires the installation of the python library ``asn1crypto``. +# In that case, you have to +# - install manually the python library in your environment +# - run again the "set state='to install'" command +# - run again the "-i dummy" command + +# put the attachment in database +cat <