Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
252 Tampilan

Dear Odoo Community,

We are currently implementing a CRM (and potentially a Helpdesk) for one of our clients. Security is a key requirement, so we are setting up development, staging, and production environments.

I’m happy to share that we've successfully created our first project in Odoo SH, made the first commits to the repository, and everything is running smoothly. I must say, Odoo SH is a powerful tool and I truly appreciate how it streamlines deployment and environment management so far.

That said, I do have a question regarding best practices for promoting changes across environments:

  • The GitHub repository linked to Odoo SH only tracks the files in the repo. As far as I understand, standard Odoo apps are installed and stored in the database rather than being tracked in GitHub.
  • When I install new apps, change system settings, or make configuration updates in staging, I would like these changes to be properly promoted to the production branch.
  • Additionally, our client plans to use Odoo Studio to add custom fields and make small adjustments in staging or dev. We also want to ensure those Studio changes are safely moved to production.

What is the correct way to handle this in Odoo SH? Are there recommended workflows or resources that explain how to properly promote database-level changes and Odoo Studio customizations across environments?

Any guidance, references, or shared experiences would be greatly appreciated.

Thanks in advance

Avatar
Buang
Jawaban Terbai

Hi,

In Odoo SH, Git manages all code in your repository, but database-level changes like installed apps, system settings, and Studio customizations are not tracked in Git. This means promoting changes across development, staging, and production requires different approaches depending on the type of change.

For database-level updates, Odoo SH allows you to create a backup of an environment and restore it into another one. This is useful for moving apps and configurations from staging to another environment. However, in production, you generally don’t overwrite the database, since it already contains live data. Instead, you replicate the same steps manually or bundle configurations into proper modules for deployment.

Studio customizations need special attention because they are stored in the database by default. The recommended practice is to export them as modules through Studio and then commit them to the Git repository. This ensures they are versioned, tested, and deployable like any other module, reducing risks of inconsistencies between environments.

A good workflow is to use development for trying new apps and customizations, staging for testing with realistic data, and production only for changes that are managed through Git and exported modules. For configurations that cannot be packaged in modules, apply them carefully in production. This approach keeps your environments consistent and makes deployments more reliable.


Hope it helps

Avatar
Buang
Penulis

this is super helpful, thanks

Penulis

As a follow up question, when you say: "The recommended practice is to export them as modules through Studio and then commit them to the Git repository" do you mean exporting the .zip file, extracting and adding the contents to the git repo or something else?

Penulis

I found this video (also from your company, nice!), but this is a simple export - import. https://www.youtube.com/watch?v=Q3dyGb6uj2o

Jawaban Terbai

I do it by scripting what is changed / configured in the staging database, so I can re-run the script in Production.

https://www.odoo.com/forum/help-1/easy-way-to-transfer-settings-from-one-database-to-another-can-i-export-them-can-i-programmatically-configure-a-database-184325


Odoo Studio is designed for a single User making relatively simple changes.

Odoo.sh is designed for a team of developers working as a team making complex changes.

Ideally you pick one or the other - so Odoo Studio is not install in most Odoo implemented databases hosted on Odoo.sh.


Odoo Studio changes can be exported and imported between databases - but test this first to ensure the export supports everything you need.

https://www.odoo.com/documentation/master/applications/studio/models_modules_apps.html#export-and-import-customizations

Avatar
Buang
Penulis

Thanks for the input Ray, much appreciated. Yesterday I indeed got export-import to work. However it feels a bit clunky. Coming from a Python background I would like to see Studio just modify some sort of configuration file. And the configuration file is tracked in the repo. Upon push, Odoo would use the configuration file in the build.

Penulis

OK in addition to this post I contacted Odoo Support and they referred to multiple of your sources, great. The lady in customer support mentioned that the best practice is to make this database schema changes and settings changes still manually in the production environment. I guess that's fine for now. It bothers me that I cannot get the database in a state using a script, the same way a dockerfile works for a container. Anyway, maybe Odoo could consider adding these best practices to the documentation.

Modules can run code the first time they are installed. You can see how we do this by reviewing the source code of the base module at https://github.com/odoo/odoo/blob/19.0/odoo/addons/base/__init__.py

post_init_hook(cr): This hook runs after the module is installed or upgraded, specifically after the database structure changes are applied. This is the hook used to run logic (like data migration or cleanup) every time a module is upgraded or freshly installed.

Penulis

very helpful, thanks. I got PGAdmin to work on a local docker instance of Odoo to better understand the database model. very insightful to understand Odoo's inner workings. For now I will keep things simple and just use a bunch of backups, rebuilds etc.

Just be aware up to 30% of the data in any given Odoo database is not persisted in PostgreSQL (calculated/computed fields). Look for Fields in the Odoo Fields Menu (Developer Mode) that are not stored.

Jawaban Terbai

Hello Rutger,



It's great to hear you're leveraging Odoo.sh for your CRM and Helpdesk implementation! Promoting changes across environments requires careful handling of both code and database elements.


Here's a breakdown of how to manage apps, settings, and Studio customizations:


  Apps and System Settings:

  Odoo apps and system settings are stored in the database. To move these changes, you'll need to update the production database with the changes from staging.

  Database Synchronization:

  The recommended approach is to create a backup of your staging database and restore it to your production environment. Be aware that this will overwrite the existing production data, so plan accordingly.

  Odoo Studio Customizations:

  Odoo Studio customizations are also stored in the database. When you transfer the staging database to production, these customizations will be included.

  Workflow:

  1. Make changes and customizations in your development or staging environment.

  2. Test thoroughly in staging.

  3. Create a backup of the staging database.

  4. Restore the staging database backup to your production environment.

  Important Considerations:

  Always test database migrations in a safe environment before applying them to production.

  Consider the impact on existing data when restoring a database backup.


For personalized assistance:
https://www.pragtech.co.in/contact-us-mql.html

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Mar 25
7078
1
Okt 24
2080
2
Okt 24
3408
0
Mei 25
3041
1
Jul 24
2682