Difference between revisions of "Odoo"

From ArchWiki
Jump to: navigation, search
(Additional Open ERP Documentation)
m (Configuring Odoo to run with PostgreSQL: Fix typo)
 
(48 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
[[Category:Office]]
 
[[Category:Office]]
{{stub}}
+
[[ja:Odoo]]
 +
[https://www.odoo.com Odoo] (formerly known as OpenERP and before that, TinyERP) is a suite of open-source enterprise management applications. Targeting companies of all sizes, the application suite includes billing, accounting, manufacturing, purchasing, warehouse management, and project management.
  
=Introduction=
+
Odoo features an application server which uses PostgreSQL as database back-end, with a web-based client. Odoo is written in Python, with a highly modular design which allows rapid development of new modules through Open Object RAD. Odoo developers have a strong commitment to free software.
  
This introduction briefly describes [http://openerp.com/ Open ERP], its basic design, and its community. The rest of this article details installing and configuring Open ERP on Arch Linux. It also provides additional information about Open ERP documentation, community, and development.
+
A thriving support and development community has grown up around Odoo, providing free technical support, bug-fixing, new development, and support services. Odoo provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Odoo earns profits through partnership services with Odoo consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.
  
Open ERP is Enterprise Resource Planning software. It provides a complete, integrated ERP solution for small and medium sized businesses and organizations. Open ERP includes financial and analytic accounting, warehouse and inventory management, sales and purchase management, customer and supplier relations management, association management, tasks automation, human resource management, marketing campaign, document management, help desk, e-commerce integration, and point of sale functionality.
+
== Installation ==
  
Open ERP features an application server which uses PostgreSQL for its database, along with a standalone GTK-based client, as well as a web-based client. It is written in the Python programming language, with a highly modular design which allows for the rapid development of new modules through Open Object RAD. Open ERP developers have a strong committment to free software.
+
=== Installing Odoo ===
  
A thriving support and development community has grown up around Open ERP, providing free technical support, bugfixing, new development, and support services. Open ERP provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Open ERP earns profits through partnership services with Open ERP consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.
+
Install the {{aur|odoo}} package. Please note that the Odoo package comes with a bunch of python2 packages available in the [[AUR]]. These dependencies and the size of Odoo require much disk space to be used (1.8Gio only for the source and the final Odoo pkg without its dependencies). If you are building manually in the current directory, please make sure your current directory is on a device with enough free space. If you are using an [[AUR helper]], please [[Tmpfs#Examples|increase the size of your tmpfs]] or configure your AUR helper accordingly.
  
=Before Installing Open ERP=
+
=== Configuring PostgreSQL to run with Odoo ===
  
===Installing PostgreSQL===
+
Odoo uses PostgreSQL as the database backend. The latter should have been installed with the odoo package as {{pkg|postgresql}} comes as a dependency.
  
Open ERP uses the PostgreSQL database, which should be installed and configured before installing Open ERP. Follow [[PostgreSQL#Installing PostgreSQL]]. Complete these installation instructions, but do '''not''' perform any other configuration from that page. Return to this page for additional configuration steps.
+
It is necessary to create a new PostgreSQL user for Odoo. For that log in as the default PostgreSQL superuser, 'postgres', by executing the following command:
 
+
*If you have {{Pkg|sudo}} and your username is in {{ic|sudoers}}:
===Configuring PostgreSQL for local use on your own machine===
+
:{{bc|$ sudo -i -u postgres}}
 
+
If you plan to use PostgreSQL and Open ERP on the same machine, you will need to configure PostgreSQL to listen on the localhost's 5432 TCP port. Open {{ic|/var/lib/postgres/data/postgresql.conf}} and navigate to the {{ic|CONNECTIONS AND AUTHENTICATION}} section. Uncomment the {{ic|listen_addresses}} and {{ic|port}} lines. Save the file. When complete, the section should appear as follows:
+
 
+
#------------------------------------------------------------------------------
+
# CONNECTIONS AND AUTHENTICATION
+
#------------------------------------------------------------------------------
+
+
# - Connection Settings -
+
+
listen_addresses = 'localhost'          # what IP address(es) to listen on;
+
                                        # comma-separated list of addresses;
+
                                        # defaults to 'localhost', '*' = all
+
                                        # (change requires restart)
+
port = 5432                            # (change requires restart)
+
 
+
Restart PostgreSQL so that it uses the newly changed conf file.
+
 
+
Verify that PostgreSQL is listening on the localhost port 5432:
+
{{hc|# ss -anpt|
+
tcp        0      0 127.0.0.1:5432          0.0.0.0:*              LISTEN      13420/postgres}}
+
 
+
===Configuring PostgreSQL for remote use over a network===
+
 
+
If you need remote access to PostgreSQL over a network, read [[PostgreSQL#Configure PostgreSQL to be accessible from remote hosts]].
+
 
+
===Setting up PostgreSQL to run with Open ERP===
+
 
+
Next, it is necessary to create a new PostgreSQL user for Open ERP. In this example, the user is 'yourusername', but you should replace this with your Arch system login username. First, log in as the default PostgreSQL superuser, 'postgres', by executing the following command from the CLI:
+
*If you have {{Pkg|sudo}} set up:
+
$ sudo -i -u postgres
+
 
*Otherwise:
 
*Otherwise:
$ su
+
:{{bc|<nowiki>
# su - postgres
+
$ su
 
+
# su - postgres
Once logged in as postgres, begin the process of creating the 'yourusername' user, with the folowing command:
+
</nowiki>}}
 
+
$ createuser yourusername -P
+
 
+
You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a [http://world.std.com/~reinhold/diceware.html Diceware Passphrase]. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n. Shall the new role be a superuser? n Shall the new role be allowed to create database? y Shall the new role be allowed to create more new roles? n
+
  
You may also use options as below to skip the interactive questions to set the attributes:
+
If the PostgreSQL instance has not been initialized yet, please follow first the [[PostgreSQL#Installing PostgreSQL|PostgreSQL install process]].
  
$ createuser yourusername --createdb --login --no-superuser --no-createrole -P
+
Once logged as the 'postgres' user, create the database user (called ''role'' in the PostgreSQL ) ''odoo'' with the command that follows.
 +
* where ''--interactive'' is used to prompt for missing role name and attributes rather than using defaults
 +
* and  ''--pwprompt''' is used to assign a password to the new role
  
Once you are finished answering these questions, type the word 'exit' to log out from PostgreSQL as the postgres superuser.
+
You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a [http://world.std.com/~reinhold/diceware.html Diceware Passphrase]. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n.
  
You may want to enable {{ic|postgresql}} with [[systemd]] so it will start at boot.
+
$ createuser odoo --interactive --pwprompt
 +
Enter password for new role:
 +
Enter it again:
 +
Shall the new role be a superuser? (y/n) n
 +
Shall the new role be allowed to create databases? (y/n) y
 +
Shall the new role be allowed to create more new roles? (y/n) n
  
This completes the installation and setup of PostgreSQL for use with Open ERP under Arch Linux. Additional detailed information about PostgreSQL configuration may be found in the [[PostgreSQL]] article, and the [http://www.postgresql.org/docs/manuals/ PostgreSQL Manuals webpage]. Also, there is a powerful GUI PostgreSQL Admin tool, [http://www.pgadmin.org/ pgAdmin], which is available in the Arch repositories.
+
You can also use the following command line to specify the options to skip the interactive questions:
 +
[postgres]$ createuser ''odoo'' --createdb --login --no-superuser --no-createrole --pwprompt
  
=Installing Open ERP from AUR=
+
Once you are finished answering these questions, type {{ic|exit}} to return to your regular user.
  
Open ERP requires the installation of the Open ERP Server, Open ERP comes with a webserver so you can use your web browser to use it. Currently, Open ERP is not available in the official repositories, but it is available through the Arch User Repository.
+
This completes the required installation and setup of PostgreSQL for use with Odoo under Arch Linux. Additional detailed information about PostgreSQL configuration can be found in the [[PostgreSQL]] article. By default, PostgreSQL only accepts connections from the local machine. If you plan to run PostgreSQL and Odoo on two different machines, you will need to follow [[PostgreSQL#Configure PostgreSQL to be accessible from remote hosts]].
  
===install Open ERP===
+
=== Configuring Odoo to run with PostgreSQL ===
  
Install {{AUR|openerp}} from the [[AUR]].
+
The configuration file of Odoo is located at {{ic|/etc/odoo/odoo.conf}}. Specify the {{ic|db_user}} and {{ic|db_password}} according to the username and password you specified at previous step. If the PostgreSQL server is on a different machine, also edit {{ic|db_host}}.
  
===configure Open ERP===
+
[options]
 +
; This is the password that allows database operations:
 +
; admin_passwd = admin
 +
db_host = False
 +
db_port = False
 +
db_user = odoo
 +
db_password = False
 +
addons_path = /usr/lib/python2.7/site-packages/openerp/addons
  
the configure file of Open ERP server is at {{ic|/etc/openerp/openerp-server.conf}}. make it look like this:
+
=== Starting the server ===
+
  [options]
+
  ; This is the password that allows database operations:
+
  ; admin_passwd = admin
+
  db_host = localhost
+
  db_port = 5432
+
  db_user = yourusername  ##this is username you created in postegres.
+
  db_password =
+
  
=== start Open ERP server===
+
Ensure PostgreSQL is running and enabled first before running the following commands.
  
use the command below to enable autostart openerp server when system boot:
+
Use the command below to start odoo automatically at boot:
  
  systemctl enable openerp-server.service
+
  # systemctl enable odoo.service
  
use the command below to start openerp:
+
Use the command below to start odoo:
  
  systemctl start openerp-server.service
+
  # systemctl start odoo.service
  
=== login to Open ERP ===
+
=== Logging in ===
  
use your favorite web browser and go to link below:
+
Go to http://localhost:8069 in your web browser to access the Odoo login page.
  
127.0.0.1:8069
+
== Running Odoo behind a reverse proxy ==
  
shows openerp login page.
+
You can run odoo behind a web server such as [[Apache]] or [[Nginx]] in reverse proxy mode. This is useful for making odoo available in a local network, under a domaine name such as {{ic|odoo.mydomain.local}}. It is also useful to enable caching for static resources, and reduce the load on your odoo application.
  
= use gunicorn to run openerp in multiple process =
+
For this to work, you need to make sure that your local DNS-server (such as [[BIND]] or [[dnsmasq]]) resolves the domain name you choose to the web server's IP address. If running on your local machine, you could simply add an entry to {{ic|/etc/hosts}} like this:
Openerp is now able to utilize multicore-CPUs by gunicorn,for more information on why to use gunicorn, please see [http://v6.openerp.com/node/1106 Serving OpenERP 6.1 on multicore systems with Gunicorn].
+
  
==install gunicorn==
+
127.0.0.1 odoo.mydomain.local
  
Install {{AUR|gunicorn}} from the [[AUR]].
+
=== Using Nginx ===
  
==write a python script ==
+
Refer to [[Nginx#Managing_server_entries|this guide]] for how to create virtual hosts in Nginx.
now you need to write a python script to run openerp. below is an example, you can change it for your needs. save it to your home directory and name it {{ic|openerp-wsgi.py}}. for more information see [https://bitbucket.org/nagyv/openerp/src/8e522d566f7d/gunicorn.conf.py?at=master.openerp_serverrc gunicorn.conf.py], note that the config file in {{ic|/etc/openerp/openerp-server.conf}} has no effect to openerp if you use this script to start openerp.
+
  
import openerp
+
Assuming your local domain is called {{ic|mydomain.local}}, and odoo is hosted on the same machine as your Nginx server, create a file inside the {{ic|servers-available}} directory that contains this server block:
# Standard OpenERP XML-RPC port is 8069
+
bind = '127.0.0.1:8069'
+
pidfile = '.gunicorn.pid'
+
# Gunicorn recommends 2-4 x number_of_cpu_cores, but
+
# you'll want to vary this a bit to find the best for your
+
# particular work load.
+
workers = 4
+
# openerp request-response cycle can be quite long for
+
# big reports for example
+
timeout = 240
+
max_requests = 2000
+
# Equivalent of --load command-line option
+
openerp.conf.server_wide_modules = ['web']
+
# internal TODO: use openerp.conf.xxx when available
+
conf = openerp.tools.config
+
# Path to the OpenERP Addons repository (comma-separated for
+
# multiple locations)
+
conf['addons_path'] = '/lib/python2.7/site-packages/openerp/addons'
+
# Optional config
+
#conf['db_name'] = 'mycompany'
+
conf['db_host'] = 'localhost'
+
conf['db_user'] = 'openerp'  ##this is username you created in postegres.
+
conf['db_port'] = 5432
+
conf['db_password'] = ''
+
conf['admin_passwd'] = 'admin'
+
conf['db_template'] = 'template1'
+
conf['syslog'] = 'False'
+
  
for a complete list of configurations in section optional config, you can use command blow to save it to {{ic|~/.openerp_serverrc}}
+
{{hc|/etc/nginx/servers-available/odoo|<nowiki>
openerp-server -s
+
upstream odoo {
 +
    server 127.0.0.1:8069;
 +
}
  
now you can use command below to run openerp with gunicorn
+
server {
  phton2 ~/openerp-wsgi.py.
+
    listen 80;
 +
    server_name odoo.mydomain.local;
 +
    root        /usr/share/nginx/html;
 +
    index      index.html index.htm;
 +
    access_log /var/log/nginx/odoo-mydomain-local.access.log;
 +
    error_log  /var/log/nginx/odoo-mydomain-local.error.log;
  
== gunicorn and systemd ==
+
    location / {
you can write a systemd script to run {{ic|openerp-wsgi.py}} as a service. below is a example
+
        proxy_pass  http://odoo;
 +
        # force timeouts if the backend dies
 +
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
 +
        proxy_redirect off;
  
[Unit]
+
        # set headers
Description= gunicorn for multi-process openerp
+
        proxy_set_header    Host            $host;
[Service]
+
        proxy_set_header    X-Real-IP      $remote_addr;
ExecStart=/usr/bin/gunicorn openerp:service.wsgi_server.application -c openerp- wsgi.py
+
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
[Install]
+
        proxy_set_header    X-Forwarded-Proto https;
WantedBy=multi-user.target
+
    }
##need to move this file to /etc/systemd/system,
+
  
save it as {{ic|gunicorn_openerp.service}} to your home directory. and move it to {{ic|/etc/systemd/system}} in root
+
    # cache some static data in memory for 60mins
cp ~/gunicorn_openerp.service /etc/systemd/system
+
    location ~* /web/static/ {
make it executable by root
+
        proxy_cache_valid 200 60m;
chmod 755 /etc/systemd/system/gunicorn_openerp.service
+
        proxy_buffering on;
start the service
+
        expires 864000;
systemctl start gunicorn_openerp.service
+
        proxy_pass http://odoo;
start the servie at boot
+
    }
systemctl enable gunicorn_openerp.service
+
}
 +
</nowiki>}}
  
=Additional Open ERP Documentation=
+
To enable, simple create a symlink:
  
There are various sources of Open ERP documentation. The best place to start is the [http://doc.openerp.com/ Open ERP Documentation webpage]. This page links to different online documents, including [http://doc.openerp.com/install/index.html detailed installation instructions]. Additionally, there is an online copy of the book, [http://doc.openerp.com/book/index.html "Open ERP for Retail and Industrial Management"],and can be purchased from [http://www.amazon.com/Open-ERP-Retail-Industrial-Management/dp/2960087607/ Amazon.com]. While Open ERP documentation, such as "Open ERP for Retail and Industrial Management" is freely downloadable, it does not come with a free documentation license.
+
# ln -s /etc/nginx/servers-available/odoo /etc/nginx/servers-enabled/odoo
  
=Open ERP Community=
+
Reload or restart {{ic|nginx}} service to enable the new configuration.
  
The Open ERP Community is centered upon the [http://openobject.com/ Open Object website]. Free technical support for Open ERP may be found in the [http://openobject.com/forum/index.php webforums], a [http://tiny.be/mailman/listinfo/tinyerp-users mailing list]{{Linkrot|2011|09|06}} which is linked to the webforums, an [http://openobject.com/irc/ IRC channel] on freenode.net, an [http://www.openobject.com/wiki/index.php/Main_Page Open ERP wiki], and the [http://doc.openerp.com/ Official ERP Documentation webpage.] The latest news may be found on [http://openerp.com/planet/ Open ERP Planet], while various Open ERP screencasts are provided on [http://www.openerp.tv/ Open ERP TV]. Fee-based support services are provided by [http://openerp.com/en/partners.html Open ERP Partners]{{Linkrot|2011|09|06}}.
+
# systemctl restart nginx.service
  
=Open Object RAD=
+
== Additional documentation==
  
Open Object is the Python-based [http://openobject.com/index.php?option=com_content&view=article&id=46&Itemid=53 Rapid Application Development framework] for developing Open ERP modules. It allows developers and businesses to customize Open ERP for specific needs. Open Object RAD development work is centered upon the [https://launchpad.net/openobject Open Object Launchpad page]. Developer news and blogs are published on [http://openobject.com/planet/ Open Object Planet]. There are pages for [http://www.openerp.com/index.php?option=com_content&view=article&id=18&Itemid=28 software downloads], [http://doc.openerp.com/modindex.html Open ERP module downloads]{{Linkrot|2011|09|06}}, and [http://openobject.com/index.php?option=com_content&view=article&id=53&Itemid=61 development source code downloads].
+
As Odoo is a complete enterprise solution, it might be rather complex to use for newcomers. Therefore, reading the [https://www.odoo.com/documentation/user/9.0/ Odoo User Documentation] and [https://www.odoo.com/documentation/9.0/ Odoo technical documentation] is highly advised.

Latest revision as of 15:35, 1 September 2016

Odoo (formerly known as OpenERP and before that, TinyERP) is a suite of open-source enterprise management applications. Targeting companies of all sizes, the application suite includes billing, accounting, manufacturing, purchasing, warehouse management, and project management.

Odoo features an application server which uses PostgreSQL as database back-end, with a web-based client. Odoo is written in Python, with a highly modular design which allows rapid development of new modules through Open Object RAD. Odoo developers have a strong commitment to free software.

A thriving support and development community has grown up around Odoo, providing free technical support, bug-fixing, new development, and support services. Odoo provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Odoo earns profits through partnership services with Odoo consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.

Installation

Installing Odoo

Install the odooAUR package. Please note that the Odoo package comes with a bunch of python2 packages available in the AUR. These dependencies and the size of Odoo require much disk space to be used (1.8Gio only for the source and the final Odoo pkg without its dependencies). If you are building manually in the current directory, please make sure your current directory is on a device with enough free space. If you are using an AUR helper, please increase the size of your tmpfs or configure your AUR helper accordingly.

Configuring PostgreSQL to run with Odoo

Odoo uses PostgreSQL as the database backend. The latter should have been installed with the odoo package as postgresql comes as a dependency.

It is necessary to create a new PostgreSQL user for Odoo. For that log in as the default PostgreSQL superuser, 'postgres', by executing the following command:

  • If you have sudo and your username is in sudoers:
$ sudo -i -u postgres
  • Otherwise:
$ su
# su - postgres

If the PostgreSQL instance has not been initialized yet, please follow first the PostgreSQL install process.

Once logged as the 'postgres' user, create the database user (called role in the PostgreSQL ) odoo with the command that follows.

  • where --interactive is used to prompt for missing role name and attributes rather than using defaults
  • and --pwprompt' is used to assign a password to the new role

You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a Diceware Passphrase. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n.

$ createuser odoo --interactive --pwprompt
Enter password for new role: 
Enter it again: 
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

You can also use the following command line to specify the options to skip the interactive questions:

[postgres]$ createuser odoo --createdb --login --no-superuser --no-createrole --pwprompt

Once you are finished answering these questions, type exit to return to your regular user.

This completes the required installation and setup of PostgreSQL for use with Odoo under Arch Linux. Additional detailed information about PostgreSQL configuration can be found in the PostgreSQL article. By default, PostgreSQL only accepts connections from the local machine. If you plan to run PostgreSQL and Odoo on two different machines, you will need to follow PostgreSQL#Configure PostgreSQL to be accessible from remote hosts.

Configuring Odoo to run with PostgreSQL

The configuration file of Odoo is located at /etc/odoo/odoo.conf. Specify the db_user and db_password according to the username and password you specified at previous step. If the PostgreSQL server is on a different machine, also edit db_host.

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/openerp/addons

Starting the server

Ensure PostgreSQL is running and enabled first before running the following commands.

Use the command below to start odoo automatically at boot:

# systemctl enable odoo.service

Use the command below to start odoo:

# systemctl start odoo.service

Logging in

Go to http://localhost:8069 in your web browser to access the Odoo login page.

Running Odoo behind a reverse proxy

You can run odoo behind a web server such as Apache or Nginx in reverse proxy mode. This is useful for making odoo available in a local network, under a domaine name such as odoo.mydomain.local. It is also useful to enable caching for static resources, and reduce the load on your odoo application.

For this to work, you need to make sure that your local DNS-server (such as BIND or dnsmasq) resolves the domain name you choose to the web server's IP address. If running on your local machine, you could simply add an entry to /etc/hosts like this:

127.0.0.1 odoo.mydomain.local

Using Nginx

Refer to this guide for how to create virtual hosts in Nginx.

Assuming your local domain is called mydomain.local, and odoo is hosted on the same machine as your Nginx server, create a file inside the servers-available directory that contains this server block:

/etc/nginx/servers-available/odoo
upstream odoo {
    server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name odoo.mydomain.local;
    root        /usr/share/nginx/html;
    index       index.html index.htm;
    access_log  /var/log/nginx/odoo-mydomain-local.access.log;
    error_log   /var/log/nginx/odoo-mydomain-local.error.log;

    location / {
        proxy_pass  http://odoo;
        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        # set headers
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

    # cache some static data in memory for 60mins
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
    }
}

To enable, simple create a symlink:

# ln -s /etc/nginx/servers-available/odoo /etc/nginx/servers-enabled/odoo

Reload or restart nginx service to enable the new configuration.

# systemctl restart nginx.service

Additional documentation

As Odoo is a complete enterprise solution, it might be rather complex to use for newcomers. Therefore, reading the Odoo User Documentation and Odoo technical documentation is highly advised.