Enable Dark Mode!
how-to-migrate-odoo-13-database-to-odoo-14.jpg
By: Mohd Ajmal M

How to Migrate Odoo 13 Database to Odoo 14

Technical Odoo 13 Odoo 14

Using the XML-RPC we can also connect two different Odoo databases and transfer data between them. Let's discuss how to transfer Partner records from Odoo 14 to Odoo 15. For this, we need both the running ports of Odoo 14 and 15 to be open. Here we use xmlrpc.client to establish a connection between the databases.

Let's move on to the flow.                                                                                                                                                                                   

First, we need to import XML-RPC client by

	import xmlrpc.client

Now we need to fetch all the partner records from Odoo 14 database by                                         

url_14 = 'http://server_name:port'

db_14 = "database_name"

login_14 = 'user_login'

pwd_14 = 'password'

common_14 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url_14))

uid_14 = common_14.authenticate(db_14, login_14, pwd_14, {})

models_14 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url_14))

records = models_14.execute_kw(db_14, uid_14, pwd_14,       'res.partner','search_read', [], {'fields': ['name', 'email']})

Here in the variables, we specified the details of our Odoo 14 database.

url_13 - url of Odoo 14 database with running port.

db_14 - Database name.

login_14 - User login for the database.

pwd_14 - Password for the database.

common_14 - Uses the xmlrpc/2/common endpoint which provides meta-calls that don’t require authentication and inside it, we specified the URL for our Odoo 14 database.

uid_14 - User identifier used in authenticated calls instead of login. The user identifier is returned for the authenticate function which authenticates using our database name, login, and password.

models_14 - Uses the xmlrpc/2/object endpoint to call the Odoo model methods using execute_kw Rpc function.

records - Values of partner records on Odoo 14 database. Here we have only fetched the name and email values of each partner record which was specified on the fields keyword.

We can check if the connection information is correct or not before authenticating by asking for the server’s version using the following code line.

	version_db_odoo14 = common_14.version()

Next we need to specify the details for Odoo 15 database as we provided for Odoo 14 database.

url_15 = 'http://server_name:port'

db_15 = "database_name"

login_15 = 'user_login'

pwd_15 = 'password'

common_15 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url_15))

uid_15 = common_15.authenticate(db_15, login_15, pwd_15, {})

models_15 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url_15))

We have already authenticated the credentials using the authenticate function to get the User identifier and fetched Partner records from Odoo 14 database using the user identifier. Now we can transfer/create these partner records into Odoo 15 database by

models_15.execute_kw(db_15, uid_15, pwd_15, 'res.partner','create', [records])

Here we have specified the database name, user identifier, password, model, and a method to be called upon the model of the Odoo 15 database and at last, we passed the values of Partner records from Odoo 14 database to be created on Odoo 15 database.

Before transferring Partner records, on the Odoo 15 database, we had only 2 records.

how-to-migrate-odoo-13-database-to-odoo-14-cybrosys

And on the Odoo 14 database, we have about 36 Partner records.

how-to-migrate-odoo-13-database-to-odoo-14-cybrosys

After the transfer of Partner records from the Odoo 14 database to the Odoo 15 database, now we have 38 records.

how-to-migrate-odoo-13-database-to-odoo-14-cybrosys

All the Partner records have been transferred from Odoo 14 database to Odoo 15 database. And that's how we can transfer data between databases using XML-RPC. Not only the Create, but we can also perform different operations like search, read, write, unlink, etc using the XML-RPC.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message