Application used in running Odoo

Before you can run Odoo, you need to install Git, Python / Pip, PostgreSQL, PG Admin 4 and NodeJS. We will install PyCharm Community Edition as our IDE. Finally, we need any browser like Chrome, Firefox, Safari, etc.

Install Git

We will use git commands to get the code of Odoo 15 community edition into our machine. To install git, copy the commands below and use terminal in your Mac. We will use HomeBrew so be sure to install it. Try these youtube videos if you have issues installing HomeBrew .

Terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Now install git using the command below:

Terminal
brew install git

Download Odoo 15 Community Edition

Using git command, copy the code of Odoo 15 community edition from GitHub . But before you do that, create the folder you want to save Odoo community. Let say we save it in this directory « /Users/alain/odoo/odoo/ ».Take note that macbookpro will be your Mac username.

Open your terminal and go inside that directory by using terminal. Type cd and click and drag odoo-server folder.

Copy the git command below, paste on your terminal and hit enter. It will take a little bit in copying the files depending on your internet speed.

Terminal
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 .

Install Python

Odoo is using Python as the main programming language. To install Python, go to Python website https://www.python.org/downloads/macos and select version higher than 3.7. In this tutorial, I will be using Python v3.8.0 . Go at the bottom and select macOS 64-bit installer. Kindly check this tutorial if you are having trouble installing it.

After installation, check your python version below. Take note that MacOS has default Python2.7 installed already.

Terminal
python3 --version

By default, if you install python, pip3 will also be installed. We will use pip3 to download python packages needed for Odoo to run. If you know ReactJS, this is the same as npm. To check Odoo python packages, open Requirements.txt in odoo-server folder.

To check pip3 version, type the code below in terminal:

Terminal
SH
pip3 --version

Install PostgreSQL and pgAdmin 4

To download PostgreSQL, go to their website https://www.postgresql.org/download/ and choose the operating system you will use. In this tutorial, we will be using macOS so choose macOS.

There are several options how you will download PostgreSQL, select Postgress.app since this is a native macOS app. If you choose this option, you will be redirected to their website https://postgresapp.com/.

Go to Downloads and select installer with current or different versions. If you want to use other versions, choose Postgres.app with all currently supported versions (Universal/Intel).

 

In order to easily manage and access PostgreSQL, we need to install pgAdmin 4. Go to https://www.pgadmin.org/download/ to download pgAdmin 4,  select the operating system and choose macOS.

Install Odoo Python Dependencies

In installing Odoo python dependencies, we need pip3. When installing python, pip3 will be automatically installed. To see all python dependencies, go to https://pypi.org/. To see all Odoo python dependencies, go inside odoo-server directory and open requirements.txt.

It is recommended to use virtual environment so that your python module packages will not be mixed up with other Odoo instances or python versions. To create virtual environment, first go to « /Users/macbookpro/tutorials/odoo/v15 » by typing cd in terminal, then click and drag v15 folder and hit enter.

Next, run the code below:

Terminal
SH
python3 -m venv odoo_venv

After running the above code, a new folder odoo_venv will be created.

Install Odoo Python Dependencies

Next, activate the virtual environment by running the code below:

Next, activate the virtual environment by running the code below:

Terminal
source odoo_venv/bin/activate

Install the python module packages by running the code below. Wait until all dependencies will be installed.

Terminal
SH
pip3 install setuptools wheelpip3 install -r ./odoo/requirements.txt

Install NodeJS

Odoo offer several languages including Arabic/Hebrew. To support these, we need to install rtlcss using npm. To use npm, we need to install NodeJS. Go to https://nodejs.org/en/ and download version LTS (Long Term Support).


Running Odoo 16

Now that all the applications needed are successfully installed, instead of using command-line, we will be using PyCharm community. But before that, make sure the PostgreSQL is running.

Create new database user

For security reason, we can not use default postgres user. To create a new user, open pgAdmin 4. For first time use, it might ask for password.

Go to Servers -> Localhost and right Login/Group Roles and select Create -> Login/Group Role…

In General, type the name. Next add the password in definition. Lastly, under privileges, toggle Can Login and Create Databases. Click Save.

Install and Setup PyCharm and Odoo Configuration

First, create a new folder under « Users/alain » and name it your_home since this will be the theme that we will create.

Download PyCharm community edition on this link .

Once downloaded, open PyCharm and choose Open and select the folder you created « your_home ».

Inside you_home folder, create Odoo configuration by creating a new file odoo.conf. Copy and paste the following code:

your_home/odoo.conf
[options]
admin_passwd = 12345
db_host = False
db_port = False
db_user = ajs
db_password = ajs
dbfilter = ^your_home.*$
db_list = True
addons_path = /Users/alain/odoo/odoo/addons
http_port = 8069

Add virtual environment by going in PyCharm -> Preferences -> Project -> Python Interpreter. Check the link of current python interpreter and if this is not the one you created under /Users/alain/odoo/odoo/addons, then click gear icon on the right side and click Add.

Select Existing Environment and locate python3 file which is located inside « odoo_venv/bin/python3 ». Click apply and okay button.

Edit PyCharm configuration by clicking on the menu bar. By default, it will create a new configuration « main ». Click main click minus (-) button on top left to delete.

Click plus (+) button to add new and choose Python. Copy the code below for the script path and parameters. Note, replace the code based on the location of your file. Click apply and OK.

PyCharm Configuration
CONF
Script Path: /Users/alain/odoo/odoo/odoo-bin 
Parameters: -c "/Users/alain/your_home/odoo.conf"

Run Odoo by clicking green arrow in the toolbar.

Go to the browser on type url http://localhost:8069. You will be redirected to http://localhost:8069/web/database/manager since there’s no database yet created.

 

 

Now that you have successfully run Odoo, let’s create a new database. The master password is the one you added in odoo.conf under admin_passwd which is 12345.

Click Create Database. You will notice in PyCharm log file that database and tables are being created. To verify if it is successful, go to pgAdmin 4, right click to databases and click refresh.

Install Odoo Website Module

Going back to Odoo in the browser, you will be automatically redirected to Apps module. Search website and click install.

You will be redirected to website configurator http://localhost:8069/website/configurator. But since we will build a theme from scratch, click the link on the bottom right corner.

Since we did not added any theme yet, you will only see the default theme of Odoo. Hover to the theme and click Use these theme. It will take some time to install then you will be  automatically redirected to the website home page.

Congratulations! You have successfully installed and run Odoo 16.

If you have deleted a db and cannot restart your remaining DB. You must recreate a DB via Terminal

How we fix database creation: error access denied odoo?

We saw what causes this error to occur. Let’s now see how our Support Engineers fix this error for our customers.

Recently, one of our customers approached us with the same error.

Our Support Engineers started troubleshooting the problem by checking if the admin_password in odoo.conf is correct. We saw the admin_password was displaying something like this,

admin_password = $pbkdf2-sha512$25000$15oTopRSSomREkLIeQ8hRA$QlTTxd4bqTTxSI0/u4g/yukO9jT2yFtTx4sAu46GtMKHnooPWT

So we won’t be able to know what is the DB-admin password.

But we can change it. So we changed it as below.

admin_passwd = 'new-password'

Then we restarted the odoo server using the command,

service odoo restart

And then we tried to recreate the DB again. This also didn’t work. So we checked for the parameters db_user and db_password in the odoo configuration file which is placed in /etc/odoo/odoo.conf.

The customer was using PostgreSQL with the specified user and password.

So we specified the same user and password in /etc/odoo/odoo.conf in parameters db_user and db_password.

Then we restarted the PostgreSQL using the command

/etc/init.d/postgresql restart

Finally, this fixed the error.

In Pycharm – Modify the admin_password = Admin

Set your Master Password = Admin

 

If you are facing any issue – Check that all these packages have been installed in this folder

_cffi_backend.cpython-38-darwin.so
_distutils_hack
_sass.abi3.so
_yaml
ansicolors-1.1.8.dist-info
babel
Babel-2.13.0.dist-info
blinker
blinker-1.6.3.dist-info
certifi
certifi-2023.7.22.dist-info
cffi
cffi-1.16.0.dist-info
chardet
chardet-5.2.0.dist-info
charset_normalizer
charset_normalizer-3.3.0.dist-info
click
click-8.1.7.dist-info
colors
cryptography
cryptography-41.0.4.dist-info
Cython
Cython-3.0.0a10.dist-info
cython.py
dateutil
decorator-5.1.1.dist-info
decorator.py
distutils-precedence.pth
docopt-0.6.2.dist-info
docopt.py
docutils
docutils-0.20.1.dist-info
flask
flask_modals
Flask_Modals_markupsafe-0.5.1.dist-info
flask-3.0.0.dist-info
gevent
gevent-20.9.0.dist-info
greenlet
greenlet-3.0.0.dist-info
idna
idna-3.4.dist-info
importlib_metadata
importlib_metadata-6.8.0.dist-info
itsdangerous
itsdangerous-2.1.2.dist-info
jinja2
jinja2_tools
jinja2_tools-1.0.7.dist-info
Jinja2-3.1.2.dist-info
libsass-0.22.0.dist-info
lxml
lxml-4.9.3.dist-info
markupsafe
MarkupSafe_slow-1.0.dist-info
MarkupSafe-2.1.3.dist-info
markupsafe-stubs
num2words
num2words-0.5.13.dist-info
OpenSSL
openssl_engine
openssl_engine-1.3.1.dist-info
passlib
passlib-1.7.4.dist-info
PIL
Pillow-10.1.0.dist-info
pip
pip-23.3.dist-info
pkg_resources
png.py
polib-1.2.0.dist-info
polib.py
psutil
psutil-5.9.6.dist-info
psycopg2
psycopg2_binary-2.9.9.dist-info
pycparser
pycparser-2.21.dist-info
pyOpenSSL-23.2.0.dist-info
pypdf
pypdf_utils
pypdf_utils-0.0.1.dist-info
pypdf-3.16.4.dist-info
PyPDF2
PyPDF2-1.26.0.dist-info
pypng-0.20220715.0.dist-info
pysassc.py
python_dateutil-2.8.2.dist-info
pytz
pytz-2023.3.post1.dist-info
pyximport
PyYAML-6.0.1.dist-info
qrcode
qrcode-7.4.2.dist-info
reportlab
reportlab-4.0.6.dist-info
requests
requests-2.31.0.dist-info
sass.py
sasstests.py
sassutils
setuptools
setuptools-56.0.0.dist-info
six-1.16.0.dist-info
six.py
tests
types_MarkupSafe-1.1.10.dist-info
typing_extensions-4.8.0.dist-info
typing_extensions.py
urllib3
urllib3-2.0.7.dist-info
validators
validators-0.22.0.dist-info
vobject
vobject-0.9.6.1.dist-info
werkzeug
Werkzeug-2.3.0.dist-info
wheel
wheel-0.41.2.dist-info
yaml
zipp
zipp-3.17.0.dist-info
zope
zope.event-5.0-py3.11-nspkg.pth
zope.event-5.0.dist-info