Skip to content

HOWTO Connect OOOR to multiple OpenERP instances (easy data migration)

Raphaël Valyi edited this page Sep 16, 2019 · 6 revisions

Basically you’ll use the model name scoping feature: so instead of calling the Product class ProductProduct, well we will now call it FooProductProduct.

So you’ll start as many Ooor instances as you have OpenERP instances but with a different :scope_prefix and then use the model of one instance to transfer data to the model of an other instance. If using the same localhost/server for all your OpenERP instance, make sure you start them on different ports.

Here a simple example with 2 OpenERP instances:

@inst1= Ooor.new({:url => 'http://localhost:8069/xmlrpc', :database => 'base_inst1', :username => 'admin', :password => 'admin', :scope_prefix => 'INST1'})
@inst2= Ooor.new({:url => 'http://localhost:8069/xmlrpc', :database => 'base_inst2', :username => 'admin', :password => 'admin', :scope_prefix => 'INST2'})
Inst2::ProductProduct.find(:all, :fields=>['name', 'categ_id']).each{|inst1_product| INST1::ProductProduct.create(:name=>inst1_product.name, :categ_id=>1)}@

Of course you can do more conversion operations than that, I assume you get the idea.