I want to use the xmlrpc for the model "product.category".

How to write the field "categ\_id" with "read and search"in PYTHON ? I have always an error. I need to do that because i have to transfer this informations into another database Odoo.

```py
    import xmlrpc.client
    import time
    url_db1="http://localhost:8069"
    db_1='DB_ONE'
    username_db_1='username'
    password_db_1='password'

    common_1 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url_db1))
    models_1 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url_db1))
    version_db1 = common_1.version()

    print("details..", version_db1)

    url_db2="http://localhost:806972"
    db_2='DB_2'
    username_db_2='myemail'
    password_db_2='mypassword'

    common_2 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url_db2))
    models_2 = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url_db2))
    version_db2 = common_2.version()

    print("details..", version_db2)

    uid_db1 = common_1.authenticate(db_1, username_db_1, password_db_1, {})
    uid_db2 = common_2.authenticate(db_2, username_db_2, password_db_2, {})

    db_1_categories = models_1.execute_kw(db_1, uid_db1, password_db_1, 'product.category', 'search_read', [[]], {'fields':['id','name', 'parent_id']})

    total_count = 0
    for category in db_1_categories:
        print("category..", category)
        total_count +=1
        values = {}
        values['id'] = category['id']
        values['name'] = category['name']
        if category['parent_id']:
            values['parent_id'] = category['parent_id'][0]
        new_lead = models_2.execute_kw(db_2, uid_db2, password_db_2, 'product.category', 'create', [values])
print("Total Created..", total_count)

```

This is the error :
ValidationError: ('The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead.\n\nModel: Product Category (product.category), Constraint: product\_category\_parent\_id\_fkey', None)\n'>

[![enter image description here](https://i.stack.imgur.com/YNupL.jpg)](https://i.stack.imgur.com/YNupL.jpg)