In product migration, one field which is one2many (Suppliers) write using xmlrpc script. The below is my code for write field.
Method for write One2many field :-
if product['seller_ids']:
seller_list = []
for seller in product['seller_ids']:
source_user1 = source_sock.execute(source_db, source_userId, source_password, 'product.supplierinfo', 'read', seller, ['name'])
dest_user = destination_sock.execute(destination_db, destination_userId, destination_password, 'product.supplierinfo', 'search', [('name', '=', source_user1['name'])])
if dest_user:
seller_list.append(dest_user[0])
else:
seller_vals = {
'name' : source_user1['name'],
'delay' : source_user1['delay'],
'min_qty' : source_user1['min_qty'],
'company_id' : company_id or False,
}
new_dest_user = destination_sock.execute(destination_db, 1, destination_password, 'product.supplierinfo', 'create', seller_vals)
seller_list.append(new_dest_user)
else:
seller_list = []
In fields :-
'seller_ids' : [(4, 0, seller_list)] or False,