Skip to main content

Manual Odoo Migration from One Server to Another

Today, we will go through a step-by-step process to move running odoo from one server to another server

Note: I assume odoo is already installed and working fine with demo/test DB.

Before migrating your Odoo application from one server to another server, it's important to take all the precautionary measures and backup all the data - Database, Code, and Files. Let's start:

I - Backup

Step-1. Database Backup 

You can use Odoo Database Manager - /web/database/manager link to perform this activity. But if the database is too big, please use pg_dump command from PostgreSQL. Here is the example:

pg_dump -W -F t odoo13 > ~/odoo13_28062021.tar

Note: Make sure that you are logged in as postgres or odoo user to perform this activity.

Step-2. Backup of custom modules

The next step is to take a backup of all of your custom code. Mostly, It will be in your /odoo/custom/ and /odoo/enterprise/ directories.

You can use scp command to directly copy your directories from one server to another server. Let's say both of your machines are Linux ones, then these commands can help you.

scp -r(for recursive directories) <source> <destination>

scp -r /odoo/custom/

Step-3. Backup of your attachments/images

The last step is to take a backup of your application attachments - order attachments, images attached to tickets, website and product images, etc. You can find the filestore at this location: 


You can copy these files also directly to the new server.

II - Restore

Step-1. Restore Database 

You can use Odoo Database Manager - /web/database/manager link to perform this activity. But if the database is too big, please use pg_restore command from PostgreSQL. Here is the command:

pg_restore -v --dbname=odoo13 odoo13_28062021.tar

Note: Make sure that you are logged in as postgres or odoo user to perform this activity and database is already created with name.

Step-2. Restoring custom modules

We have already copied these files in step-2 of the Backup section activity. If not done, please use the scp command to copy files at the new server location.

Note: Make sure that odoo is the owner of all these files. You can use this command to change ownership of the directory and subdirectory.

chown -R odoo:odoo /odoo/custom/

Step-3. Restore filestore

We have already copied these files in step-3 of the Backup section activity. If not done, please use the scp command to copy files at the new server location.

III - Reload Odoo

Once all data - Database, custom modules, and filestore is restored on the new server, the next step is to start odoo with the latest data. I would suggest doing it using the shell/command line if you are a developer.

Step-1. Stop all odoo services

ps ax | grep odoo-bin | awk '{print $1}' | xargs kill -9 $1

Step-2. Start odoo services.

python3 /odoo/odoo-server/odoo-bin -c /etc/odoo-server.conf -d odoo13 -u all

Once all the modules are updated successfully, you can just stop the odoo services using step-1 command and start it using.

sudo service odoo-server start

Step-3. Reload assets - log in as admin and reload assets

I hope everything went well as expected. If your UI is distorted, there is a possibility that fingerprints generated for js and css files are not the same as in filestore. To fix it we have to reload assets.


I hope this POST will help someone, someday and save his/her day!

Thanks!! Enjoy Programming :)


Popular posts from this blog

Odoo/OpenERP: one2one relational field example

one2one relational field is deprecated in OpenERP version>5 but you can achieve the same using many2one relational field. You can achieve it in following two ways : 1) using many2one field in both the objects ( ) 2)  using inheritance by deligation You can easily find the first solution with little search over internet so let's start with 2nd solution. Scenario :  I want to create a one2one relation between two objects of openerp hr.employee and hr.employee.medical.details What I should do  i. Add _inherits section in hr_employee class ii. Add field medical_detail_id in hr_employee class class hr_employee(osv.osv):     _name = 'hr.employee'     _inherits = {' hr.employee.medical.details ': "medical_detail_id"}     _inherit = 'hr.employee'         _columns = {              'emp_code':fields.char('Employee Code', si

Odoo: Download Binary File in v10

To download any binary file in Odoo10 following is the link:<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id> module_name    - the name of the model with the Binary field field_name         - the name of the Binary field object_id            - id of the record containing particular file. field_filename    - name of a Char field containing file's name (optional). So if you want to call a function on button click and download the file, code is as follow: file_url = "<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id>" return {     'type': 'ir.actions.act_url',     'url': file_url,     'target': 'new' } In Reports or web page, you can use it as: <t t-foreach="files&qu

Odoo/ OpenERP: Customize one2many relational field

I was working on one2many relational field to integration one functionality. Worked on python code and then wrote an xml file for the same. Restarted my server. It showed me the row with headers and 'Add an item' button. When clicked on that it opened a pop-up to provide inputs. It shows all the fields with in sequence of it's own. Q1. I need input fields in other sequence or don't need all fields. A.   In xml you would have wrote code like this : <field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1"> <tree string="Details">              <field name="field1" />              <field name="field2" />                      ---------------------------------------------              <field name="designation" />         </tree>                                                     </field> Add form section inside and