Installing Odoo From Sources
Odoo is a suite of business apps including CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management to name a few. It’s a very popular ERP solution among SMEs. The community edition of Odoo is available as an open-source software which makes small and medium businesses to leverage Odoo for their businesses with very low budget or cost.
Earlier in my post I have covered OFBiz ERP which is also open source ERP suite, now we will go through Odoo in detail starting with complete step by step guide for the beginners.
There are couple of ways to install Odoo
- Using Odoo Packaged Installer
- Installing Odoo from Sources
First option is useful for those who just want to install Odoo and see different features provided by default in the system. It is not possible to add or update any existing features or modify it based on your business needs.
For such needs the second option is useful. It provides greater control over the system’s set up, and allows to more easily keep (and run) multiple versions of Odoo side-by-side. We are going to cover this option in this blog.
So, let’s get started!
Installation
We will see how to install Odoo on Windows system by building or compiling the Odoo source code. This option will help you further to update the Odoo modules and you can see the changes reflected on Odoo system.
Installing Odoo on Windows
Fetch the sources
There are two ways to obtain the source code of Odoo:
- zip archive
- Through git.
Zip Archive
Community Edition:
Git
The following requires git to be installed on your machine and that you have basic knowledge of git commands.
Community Edition:
git clone https://github.com/odoo/odoo.git
Prerequisites
Python
Odoo requires Python 3.6 or later to run. Visit Python’s download page to download and install the latest version of Python 3 on your machine.
During installation, check Add Python 3 to PATH, then click Customize Installation and make sure that pip is checked.
If Python 3 is already installed, make sure that the version is 3.6 or above, as previous versions are not compatible with Odoo.
python --version
verify also that pip is installed for this version
pip --version
PostgreSQL
Odoo uses PostgreSQL as database management system. Download and install PostgreSQL (supported version: 10.0 and later).
By default, the only user is postgres
but Odoo forbids connecting as postgres
, so you need to create a new PostgreSQL user:
- Add PostgreSQL’s
bin
directory (by default:C:\Program Files\PostgreSQL\<version>\bin
) to yourPATH
. - Create a postgres user with a password using the pg admin gui:
- Open pgAdmin.
- Double-click the server to create a connection.
- Select Object ‣ Create ‣ Login/Group Role.
- Enter the username in the Role Name field (e.g.
odoo
). - Open the Definition tab and enter the password (e.g.
odoo
), then click Save. - Open the Privileges tab and switch Can login? to
Yes
and Create database? toYes
. - Click on Save button to create a user
Dependencies
Before installing the dependencies, you must download and install the Build Tools for Visual Studio. When prompted, select C++ build tools in the Workloads tab and install them.
Note: This requires approximately 6GB space on your machine.
Odoo dependencies are listed in the requirements.txt
file located at the root of the Odoo community directory. There are few tweaks required to successfully install Odoo on Windows machine.
- Comment psycopg2 dependency in requirements.txt file and install it manually using below command and update PATH variable
pip3 install psycopg2
setx PATH "%PATH%;C:\Users\abc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts"
2. Upgrade passlib library to 1.7.2 to avoid time related issues
3. Manually install psutil and comment in requirements.txt file
pip install psutil
I am sharing my requirements.txt file for your reference:
Babel==2.6.0
chardet==3.0.4
decorator==4.3.0
docutils==0.14
ebaysdk==2.1.5
feedparser==5.2.1
freezegun==0.3.11; python_version < '3.8'
freezegun==0.3.15; python_version >= '3.8'
#gevent==1.1.2 ; sys_platform != 'win32' and python_version < '3.7'
#gevent==1.5.0 ; python_version == '3.7'
#gevent==20.9.0 ; python_version >= '3.8'
#gevent==1.4.0 ; sys_platform == 'win32' and python_version < '3.7'
greenlet==0.4.10 ; python_version < '3.7'
greenlet==0.4.15 ; python_version == '3.7'
greenlet==0.4.17 ; python_version > '3.7'
html2text==2018.1.9
idna==2.6
Jinja2==2.10.1; python_version < '3.8'
# bullseye version, focal patched 2.10
Jinja2==2.11.2; python_version >= '3.8'
libsass==0.17.0
lxml==3.7.1 ; sys_platform != 'win32' and python_version < '3.7'
lxml==4.3.2 ; sys_platform != 'win32' and python_version == '3.7'
lxml==4.6.1 ; sys_platform != 'win32' and python_version > '3.7'
lxml ; sys_platform == 'win32'
Mako==1.0.7
MarkupSafe==1.1.0
num2words==0.5.6
ofxparse==0.19
passlib==1.7.2
Pillow==5.4.1 ; python_version <= '3.7' and sys_platform != 'win32'
Pillow==6.1.0 ; python_version <= '3.7' and sys_platform == 'win32'
Pillow==8.0.1 ; python_version > '3.7'
polib==1.1.0
#psutil==5.6.6
#psycopg2==2.7.7; sys_platform != 'win32' and python_version < '3.8'
#psycopg2==2.8.5; sys_platform == 'win32' or python_version >= '3.8'
pydot==1.4.1
#python-ldap==3.1.0; sys_platform != 'win32'
PyPDF2==1.26.0
pyserial==3.4
python-dateutil==2.7.3
pytz==2019.1
pyusb==1.0.2
qrcode==6.1
reportlab==3.5.13; python_version < '3.8'
reportlab==3.5.55; python_version >= '3.8'
requests==2.21.0
zeep==3.2.0
#python-stdnum==1.8
vobject==0.9.6.1
Werkzeug==0.16.1
XlsxWriter==1.1.2
xlwt==1.3.*
xlrd==1.1.0; python_version < '3.8'
xlrd==1.2.0; python_version >= '3.8'
pypiwin32 ; sys_platform == 'win32'
Navigate to the path of your Odoo Community installation (CommunityPath
) and run pip on the requirements file in a terminal with Administrator privileges:
cd \CommunityPath
pip install setuptools wheel
pip install -r requirements.txt
Running Odoo
Once all dependencies are set up, Odoo can be launched by running odoo-bin
, the command-line interface of the server. It is located at the root of the Odoo Community directory.
Common necessary configurations are:
- PostgreSQL user and password.
- Custom addon paths beyond the defaults, to load your own modules.
A typical way to run the server would be:
cd CommunityPath/
python odoo-bin -r odoo -w admin --addons-path=addons -d mydb
Where CommunityPath
is the path of the Odoo Community installation, odoo
is the PostgreSQL login, admin
is the PostgreSQL password and mydb
is the default database. You can add other directory paths separated by a comma to addons
at the end of the addons-path option.
Now navigate to below URL to access Odoo
It will ask for the username and password, please enter below credentials which are default Odoo credentials
- Username: admin
- Password: admin
Click on Log in to login into Odoo Dashboard
That’s it! You have successfully installed Odoo on Windows and you can start using it.
Odoo Docker Installation
We will see how Odoo can be installed with Docker setup. Its very easy and quick compared to installing it from sources. But you will not be getting all the benefits of installing Odoo from sources as discussed above.
So, lets get started.
Odoo Docker installation requires a running PostgreSQL server.
Start a PostgreSQL server
If you dont have postgres image, get it by executing below first command else skip it
docker pull postgres
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres
Start an Odoo instance
$ docker run -p 8069:8069 --name odoo --link db:db -t odoo
The alias of the container running Postgres must be db for Odoo to be able to connect to the Postgres server.
That’s it! You can now access Odoo by navigating to http://localhost:8069/
First, it will ask you need to secure your database and create new one. Also it will create an account for you, note down the email and password because you will need later to login into Odoo
Once above process is done navigate to localhost URL, enter credentials that you have set up and you will be redirect to Odoo Dashboard
Stop and restart an Odoo instance
$ docker stop odoo
$ docker start -a odoo
Stop and restart a PostgreSQL server
When a PostgreSQL server is restarted, the Odoo instances linked to that server must be restarted as well because the server address has changed and the link is thus broken.
Restarting a PostgreSQL server does not affect the created databases.
Run Odoo with a custom configuration
The default configuration file for the server (located at /etc/odoo/odoo.conf
) can be overriden at startup using volumes. Suppose you have a custom configuration at /path/to/config/odoo.conf
, then
$ docker run -v /path/to/config:/etc/odoo -p 8069:8069 --name odoo --link db:db -t odoo
You can also directly specify Odoo arguments inline. Those arguments must be given after the keyword --
in the command-line, as follows
$ docker run -p 8069:8069 --name odoo --link db:db -t odoo -- --db-filter=odoo_db_.*
Run multiple Odoo instances
$ docker run -p 8070:8069 --name odoo2 --link db:db -t odoo
$ docker run -p 8071:8069 --name odoo3 --link db:db -t odoo
Please note that for plain use of mails and reports functionalities, when the host and container ports differ (e.g. 8070 and 8069), one has to set, in Odoo, Settings->Parameters->System Parameters (requires technical features), web.base.url to the container port (e.g. 127.0.0.1:8069).
Recommendation
If you want to go in depth and learn more about Odoo, I would recommend below books.
- Learn Odoo: A beginner’s guide to designing, configuring, and customizing business applications with Odoo
- Working with Odoo: Learn how to use Odoo, a resourceful, open source business application platform designed to transform and modernize your business
- Odoo Development Essentials
Recommendation
Please refer below recommended books for more information:
- Learn Odoo: A beginner’s guide to designing, configuring, and customizing business applications with Odoo
- Odoo 14 Development Cookbook: Rapidly build, customize, and manage secure and efficient business apps using Odoo’s latest features, 4th Edition
- Working with Odoo: Learn how to use Odoo, a resourceful, open source business application platform designed to transform and modernize your business
Conclusion
So, in this article we saw step by step how to install Odoo from source code.
References
odoo.com
I am trying to install it from the source. I did all the steps. Once I enter the following command
python odoo-bin -r odoo -w password –addons-path=addons -d mydb.
It starts the execution but it is not completed. For more than 2 hours same screen was showing.
My command prompt text as below:
2023-05-12 05:37:50,224 13360 INFO ? odoo: Odoo version 16.0
2023-05-12 05:37:50,224 13360 INFO ? odoo: addons paths: [‘C:\\xampp\\htdocs\\odoo\\odoo\\addons’, ‘c:\\users\\hp\\appdata\\local\\openerp s.a\\odoo\\addons\\16.0’, ‘c:\\xampp\\htdocs\\odoo\\addons’, ‘c:\\xampp\\htdocs\\odoo\\odoo\\addons’]
2023-05-12 05:37:50,224 13360 INFO ? odoo: database: odoo@default:default
2023-05-12 05:37:50,436 13360 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
2023-05-12 05:37:50,743 13360 INFO ? odoo.service.server: HTTP service (werkzeug) running on DESKTOP-ADNI0E9:8069
2023-05-12 05:37:50,792 13360 INFO mydb odoo.modules.loading: loading 1 modules…
2023-05-12 05:37:50,797 13360 INFO mydb odoo.modules.loading: 1 modules loaded in 0.00s, 0 queries (+0 extra)
2023-05-12 05:37:50,845 13360 INFO mydb odoo.modules.loading: loading 8 modules…
2023-05-12 05:37:50,931 13360 INFO mydb odoo.modules.loading: 8 modules loaded in 0.09s, 0 queries (+0 extra)
2023-05-12 05:37:50,957 13360 INFO mydb odoo.modules.loading: Modules loaded.
2023-05-12 05:37:50,962 13360 INFO mydb odoo.modules.registry: Registry loaded in 0.222s
Hello,
Check if your database is configured correctly? Is your Odoo schema tables have been populated? If not you can debug in that direction.