Skip to content Skip to sidebar Skip to footer

How To Pass Many2one Object In Xmlrpc For Openerp

I have django as front-end app, where I am saving 'res.partner' id relating to django user. Based on that id I am fetching 'res.partner' object from openerp. Now I want pass that

Solution 1:

You need to pass id value (db id field) to the field(many2one).

Please check documentation here

In the doucmentation you can see partner_id is created and the id field is returned there

import xmlrpclib

sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
uid = 1
pwd = 'demo'

partner = {
    'title': 'Monsieur',
    'name': 'Fabien Pinckaers',
    'lang': 'fr',
    'active': True,
}

partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)

address = {
    'partner_id': partner_id,
    'type': 'default',
    'street': 'Rue du vieux chateau, 21',
    'zip': '1457',
    'city': 'Walhain',
    'phone': '(+32)10.68.94.39',
    'fax': '(+32)10.68.94.39',
}

sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)

Post a Comment for "How To Pass Many2one Object In Xmlrpc For Openerp"