+3 votes

I want to insert records of data from local Odoo server to another remote odoo server using web service like xmlrpc pr erppeek how can I do that

in Back-end by (10.5k points) | 40 views

1 Answer

+2 votes
Best answer

you can do a module to call the external odoo api or just do a python script like:

by (4.6k points)
selected by
url_old = 'https://oldodoo.server.com'
db_old = 'production'
username_old = 'admin'
password_old = 'admin'  

url = 'http://actualodoo.server.com'
db = 'production'
username = 'admin'
password = 'admin'         

import xmlrpclib
common_old = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url_old))
uid_old = common_old.authenticate(db_old, username_old, password_old, {})
models_old = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url_old))
products_old =  models_old.execute_kw(db_old, uid_old, password_old,'product.template', 'search_read',[[]],{'fields': ['name']})

common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))

for data in products_old:
    models.execute_kw(db, uid, password, 'product.template', 'create', [{'name': data['name']}])
205 questions
180 answers
220,631 users