Odoo Configurations (docker)

Bahmni/odoo-10 image is based on Odoo v.10 which acts as an inventory management system with Bahmni. The image is built and published using Github actions from odoo-modules repository.

Bahmni/odoo-connect image is used to enable atomfeed sync to fetch drugs, lab-tests, patient medication orders to Odoo. The image is built and published using Github actions from openerp-atomfeed-service repository.

 

Sub-Domain or Exposing Port for Odoo

Odoo cannot be routed through proxy on the same domain as other Bahmni services. So either it can be accessed directly on port 8069 or through a sub-domain mapping to the same public IP address as Bahmni. The index page of Bahmni detects the URL by which you access the server and if it an IP or localhost, the redirection happens to http://<ip/localhost>:8069 and if it is a FQDN, the redirection happens to erp-<your-fqdn>. The prefix erp is a configuration and it can be configured from here. Based on the prefix, you can create a A record that maps the domain to the server IP address in your DNS provider. For a production system accessed over internet it is recommended to setup the domain based routing and add an SSL certificate.

One-time Setup for Odoo

The below steps needs to be performed only once when Odoo is created.

  1. Once the container spins up, login to the application.

  2. Navigate to Apps from the menu bar.

  3. Click on Bahmni Account app and then click on Upgrade.

  4. Wait for the upgrade to complete and you will redirected to home page.

  5. After redirection, refresh your page once.

Now Odoo should be working fine. If you don't see old patient data coming into Odoo in 10 mins, please read Odoo not synchronizing old patient data.

Environment Configurations

Odoo Variables

Variable Name

Description

Variable Name

Description

ODOO_IMAGE_TAG

This value tells which image version to be used for ODoo Application. List of tags can be found at bahmni/odoo-10 - Tags .

ODOO_DB_IMAGE_NAME

This value tells which image to be used for Odoo Database. There are two variants available.
bahmni/odoo-10-db:fresh-latest - Has only schema and default data.
bahmni/odoo-10-db:demo-latest - Has schema and demo data loaded.
List of image tags can be found at bahmni/odoo-10-db - Tags .

ODOO_DB_USER

This value is used as username for Odoo Postgres DB instance. This is also referenced in Odoo application.

ODOO_DB_PASSWORD

This value is used as password for Odoo Postgres DB instance. This is also referenced in Odoo application.

ODOO_DB_DUMP_PATH

When you want to restore an existing database of Odoo from a dump file you can set the folder path to your dump file with this variable. This is a one time setup and the restore happens only when the database is clean and fresh. So whenever you need a restore make sure you follow the steps in Cleaning Application data

EXTRA_ADDONS_PATH

When you want to installl an additional addon, you can set the path of the root directory which contains your module directory.

Odoo Connect Configurations

Variable Name

Description

Variable Name

Description

ODOO_CONNECT_IMAGE_TAG

This value tells which image version to be used for Odoo Connect Application. List of tags can be found at bahmni/odoo-10 - Tags .

Odoo not synchronizing old patient data

Perform the followinng steps if older patient data is not being sent to Odoo. This likely happened because the ATOM Feed reader has already exhausted its max retry limit for failed events (by default set to 5 times). You can set the Failed events retry back to 1, and that should sync them immediately. Steps to fix this:

  1. Open terminal in your local machine, in bahmni-docker folder.

  2. Execute docker ps to see the list of running containers.

  3. Connect to the Odoo postgres DB container by executing the command: docker container exec -it bahmni-docker_odoodb_1 /bin/bash where bahmni-docker_odoodb_1 is the name of the odoo postgres container. You should now be within the container.

  4. Connect to the postgres console using command: psql -Uodoo odoo. For more info on how to connect to Bahmni Databases, refer to this wiki page: Connecting to various databases.

  5. In the psql prompt type: select count(*) from failed_events; This will show you the number of failed events.

  6. If 1 or more events are there, then you can fire the query: select id,retries from failed_events;. You should see all failed events have reached their retry limit.

  7. Fire an update statement to reset the retry count for all failed events: update failed_events set retries=1;

  8. Now in about a minute, all failed events should be processed and old patient data should get synced to Odoo.

  9. To exit the container, first type \q to exit postgres shell, and then type exit to exit bash shell without stopping the postgres container.

Loading Additional Addons to Odoo

When you want to load additional addons to Odoo instance, you can set the EXTRA_ADDONS_PATH with the directory that contains your modules.

  1. Bring down Odoo if it is already running by doing docker-compose down .

  2. Set the path of your root directory of modules to EXTRA_ADDONS_PATH variable.

  3. Restart Odoo instance by running docker-compose up

  4. Login to the application

  5. Navigate to Settings page in the web and enable Developer Mode

  6. Navigate to Apps page and Click on Update Apps List

  7. Your new module will be listed and you can install it.

For example you can download Open HRMS modules from here which provides a complete HR Management System. You need to extract the downlooaded zip file and set the extracted folder path to EXTRA_ADDONS_PATH.

Note: Make sure the addons are compatible with Odoo v10.0

 

Development setup for Bahmni Odoo Modules

Note: Do these steps only if you need to update Bahmni Odoo modules.

  1. Clone the Bahmni/odoo-modules repo at https://github.com/Bahmni/odoo-modules.git

  2. Bring Bahmni down by running docker-compose down -v from bahmni-docker directory.

  3. Update the BAHMNI_ODOO_MODULES_PATH variable in .env file with the cloned directory path. Also update COMPOSE_PROFILE=odoo so that only odoo services start.

  4. Now in docker-compose.yml uncomment the volume commented under odoo service.

  5. Start Odoo services by running docker-compose up

  6. Enable developer mode in Odoo by navigating to Settings page in Odoo Web and click Activate the Developer Mode

  7. After you perform a change, do the following steps to reflect the changes.

  8. Run docker-compose restart odoo

  9. Now in the browser navigate to Apps menu. Click on the app that is updated and click Upgrade.

  10. Now you should see the changes reflected. If not try from Step 8 & 9 once again.

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)