How to do an Odoo inventory import

In Odoo, inventories are managed through Inventory / Inventory Control / Inventory Adjustments. Importing your stock, means creating an inventory adjustment. You will import your first stock (initial inventory), using exactly the same procedure as later stock’s imports.

Minimal prerequisites

  • At least one warehouse created (should be done automaticaly)
  • Products and variants already imported

First obvious option is to create a new Inventory Adjustment, checking the « All products » option. Then press Start Inventory button : products will be populated. You can modify stock inline in Real Quantity column. But with lots of products, you will prefer to export :

  1. keep your first Inventory Adjustment in draft mode,
  2. go back to Inventory Adjustments, select your inventory, export it (select the required fields as the below list),
  3. update your spreadsheet and import it back.

Required fields to export / import

  • Company (company id) : company_id/id, usually « base.main_company »
    (this field should have only one record)
  • Inventoried Location (warehouse) : location_id/id, with only one warehouse it will be « stock.stock_location_stock »
    (this field should have only one record)
  • Inventory Reference (inventory name) : name, whatever
    (this field should have only one record)
  • Inventories / Product (product external id) : line_ids/product_id/id
  • Inventories / Product Name : line_ids/product_name
  • Inventories /Checked Quantity (product stock) : line_ids/product_qty

You will get also (automaticaly added) :

  • Stock inventory id (external id) : id
  • Inventories : line_ids/location_id/id

Step by step how-to

Open a spreadsheet, populate it with your product names, product external id and product quantity — much easier to export them from Odoo ; export from product’s variants if you use them.

Rename your columns as follow :

  • Product name : line_ids/product_name
  • Product external id : line_ids/product_id/id
  • Product quantity : line_ids/product_qty

Add following columns / field’s name at the end. The order doesn’t matter :

  • company_id/id
    (this column will contain one record on the first line only)
  • location_id/id
    (this column will contain one record on the first line only)
  • name
    (this column will contain one record on the first line only)
  • line_ids/location_id/id
    (every line will contain the same value as the first line of location_id/id)

Once imported, a new entry will be created in Draft status. Open the entry and press Start Inventory. Validate the inventory if everything is ok.


How to export an aging inventory with Odoo

Odoo apps are well integrated. Products datas are shared accros modules, and the accounting module can « talk » very well with the inventory one. Doing everything in Odoo is easy. But sometimes you need just a spreadsheet with your past inventory at a precise date. That functionality is a bit hidden. Here’s how to enable it :

  1. install the Accounting module
  2. enable multi-location inventory
  3. switch to developper mode to see hidden menus
  4. go to Inventory / Reports / Aging inventory

To export :

Quickly done

… but product name, stock and stock value only

  1. on the right of the list view, click on Tableau Croisé dynamique
  2. now click on the download icon (xls file)

Complete nightmare

… but you may be able to export every needed field

  1. from list view unfold all products, check the checkbox
  2. click on Action / Export
  3. click on all available fields
  4. choose your fields, don’t forget inventory moves, quants and associated dates
  5. export
  6. try to play with your spreadsheet
  7. go to Quickly done

Odoo installation on a minimal Centos 7.x / RedHat 7.x web server

This how-to describe a minimal Odoo installation on Centos or RedHat. It can be easily adapted to any Linux distribution (Debian, Ubuntu, SuSE, Mandriva, Arch Linux, …). This a simple, easy and rock-solid way to install Odoo for small groups.

An eye on the doc

First steps — just for those who forget something

Create one user account, add the user to the wheel group. This will let you use sudo. Add your ssh-key, from local to remote :

$ ssh-copy-id -i ~/.ssh/ user@IP

Install yum utilities and some of your favorite’s command-line tools. Yum utilities comes with the useful yum-config-manager. Even if you don’t use it, it can show you the whole params of each repositories. Here below I install  Lynx text browser to read html pages in Midnight-Commander.

# yum install yum-utils
# yum install nano mlocate screen wget mc lynx unzip

Install postgresql-server and start it, otherwise Odoo will not be able to create odoo user.

# yum install postgresql-server
# postgresql-setup initdb
$ systemctl start postgresql

Enable EPEL repository

We need complementary packages, not provided by distribution repository. Basicaly we have two solutions :

  1. add Software Collections packages
  2. add new repositories

Software Collections are installed in parallel from distribution’s package. Our server will only run Odoo, so there is no need to separate packages. It is easier to add repositories.

EPEL is Extra Packages for Enterprise Linux. The epel-release package is included in the CentOS Extras repository that is enabled by default. One just need to type :

# yum install epel-release

To clear any cached information, and to make sure the changes are immediately recognized :

# yum clean all 
# yum update

If you need, install some more utilities from Epel. I like p7zip.

Add Odoo repository

Odoo provide package. You can download it or install from nightly builds repository (both are the same).

# yum-config-manager --add-repo=
# yum clean all
# yum update
# yum install odoo
$ systemctl start odoo

Download wkhtmltopdf and install it. Do not use the package from Epel repository as it can’t handle headers and footers.

A bit of testing

Stop Firewalld and connect to http://[your-hostname]:8069/ default login/password is admin/admin. Create a dummy or template database. Don’t install applications, just configure Administrator account :
in configuration menu, go to users and change Administrator’s timezone, email, and choose a solid password. You will be disconnected. Login with the new params. If it’ ok, disconnect again and stop Odoo server. Restart Firewalld to protect your web server.

Basical configuration

Odoo master password, Firewalld, fail2ban, services.

Choose a new Odoo master password. You may play with a password generator. Add it to odoo.conf :

# nano /etc/odoo/odoo.conf

; This is the password that allows database operations:
admin_passwd = whatever big and solid
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/odoo/addons

Need to open the port on Firewalld. We create Odoo service that we will enable on the firewall public zone.

# nano /etc/firewalld/services/odoo.xml

<?xml version="1.0" encoding="utf-8"?>
  Open Odoo default port.
 <port protocol="tcp" port="8069"/>

Enable Odoo on public zone ; the –permanent option needs to be the first option for all permanent calls (1). Don’t forget to reload the firewall !

# firewall-cmd --permanent --zone=public --add-service=odoo
# firewall-cmd --reload

Similarly, enable http and https services:

# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

Install and start Fail2ban, then enable services on startup :

# systemctl enable postgresql
# systemctl enable odoo
# systemctl enable fail2ban

And start Odoo again. Connect to Odoo.

A template database

Now we will setup a « template » database. Something with all the basics that we need. Start with security and backup :

Install Letsencrypt and Database Auto-Backup module from OCA’s server tools repository. Download zip from

Setup auto-backup. Test it : make a backup, get it, try to restore.

You will certainly need to increase the time-out on your server. Beware that as long as you db grows, the backup grows as well. But the heavier part will certainly be the multiples files (images, documents, …) that Odoo will generates for you.

Use Letsencrypt to get an SSL certificate as soon as domains are moved on your server.

Web environment ribbon is a very useful utility for those who works on several Odoo instances. You will got a red ribbon on the top left corner in every page (ribbon name and color can be changed).

Add users, configure company, email servers, etc.

Backup or duplicate your database with Odoo database manager. You will leave your first copy untouched. It will be used as a template. For further installations, just duplicate your template and install everything you need.

If you want a server admin panel

Avoid extra dependencies (PHP, MySQL, …). If you can, choose Perl based or Python based software if possible.

  • Webmin use Perl, it have a lots of modules, is actively developped, but old ;
  • BlueOnyx is built with Java and Perl, based on a product developped by Cobalt, it’s solid but  a bit old ;
  • Ajenti use Python but does only a few things so far, it is recent and light ;
  • A few other ones doesn’t need MySQL, but use PHP.

Accelerate Odoo

Depending on what you need you will configure Postgresql, Odoo and Nginx web server for speed and efficiency.

How-to move Odoo to another server

On the old server Odoo is setup with e-commerce website. On the new server, avoid extra dependencies if Odoo doesn’t need them (web server, php, …).

First steps

  1. keep a TODO-list
  2. create a subdomain, to test your paiement module on the new server
  3. install your ssh-key
  4. install some command-line tools : midnight-commander, nano editor, mlocate, wget, screen, unzip
  5. might want to install a graphical web-server admin. I like Webmin, because it’s well maintained, depends only of Perl and use its own web server.
  6. install a networked resource monitoring tool with graphs output, like Munin (or webminstats if you use Webmin)
  7. install Postgresql, create necessary users and configure it. Refer to Odoo install documentation.
  8. install Odoo, setup Odoo with workers and debug log
  9. stop firewall to access Webmin and Odoo, you will configure the firewall later (TODO list)

Setup Odoo

  1. create a dummy database with all necessary modules, add all modules you had on the old server. Test it (might want to include demo datas to test it extensively — check ‘evaluate Odoo’ when you are creating the database).
  2. test your credit card paiement module
  3. backup your old Odoo database
  4. create a new, empty, database on the new server
  5. restore your old database on the new database. test it extensively
  6. install letsencrypt Odoo module, first install python-pip, then do
    sudo pip install acme-tiny
    sudo pip install IPy
  7. install auto backup odoo module on the new server and test it : do a backup/restore operation. First install python-pip and do
    sudo pip install pysftp
  8. install nginx and set it up
  9. install fail2ban
  10. open necessary ports on the firewall and restart it