Skip to content

fix: initialize Odoo database before service start - #21

Merged
boGSer98 merged 1 commit into
fix/source-addons-path-includes-basefrom
fix/initialize-odoo-database
Jun 4, 2026
Merged

boGSer98 merged 1 commit into
fix/source-addons-path-includes-basefrom
fix/initialize-odoo-database

Conversation

@boGSer98

@boGSer98 boGSer98 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • creates/validates a UTF8 PostgreSQL database before the Odoo service starts
  • initializes Odoo's base module once with --without-demo=all --stop-after-init
  • aborts instead of silently touching an already-initialized non-UTF8 Odoo database
  • documents the new INITIALIZE_ODOO_DATABASE and ODOO_DATABASE_NAME settings

Dependency

Stacked on PR #20 / branch fix/source-addons-path-includes-base because database initialization depends on the corrected source-install addons_path containing Odoo core modules such as base.

Test Plan

  • python3 -m unittest tests/test_installer_features.py -v
  • bash -n odoo_install.sh
  • scripts/validate.sh
  • git diff --check

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d81f35036a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread odoo_install.sh
exit 1
fi
echo "Recreating uninitialized database $ODOO_DATABASE_NAME with UTF8 encoding."
sudo -u postgres dropdb "$ODOO_DATABASE_NAME"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid dropping non-Odoo databases

When ODOO_DATABASE_NAME points at an existing non-UTF8 database that is not an Odoo database, this path treats the absence of public.ir_module_module as proof that it is safe to recreate and then runs dropdb. That can delete unrelated data on hosts that already have a database with the configured name, which is plausible because initialization is enabled by default and the name is user-configurable; please verify the database is empty or explicitly owned/created by this installer before dropping it.

Useful? React with 👍 / 👎.

Comment thread odoo_install.sh
; This is the password that allows database operations:
admin_passwd = ${OE_SUPERADMIN}
${ODOO_PORT_CONFIG}
db_name = ${ODOO_DATABASE_NAME}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not force db_name when initialization is disabled

Even when INITIALIZE_ODOO_DATABASE="False", the generated Odoo config now always includes db_name = odoo by default. In that disabled-initialization scenario the script no longer preserves the previous behavior of allowing Odoo's database manager or existing databases with other names to be used, so disabling the new feature still leaves installations filtered to a single database unless users also discover and override ODOO_DATABASE_NAME.

Useful? React with 👍 / 👎.

@boGSer98
boGSer98 merged commit 90cc0d2 into fix/source-addons-path-includes-base Jun 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant