문제

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 "res.partner" object to openerp field having many2one relation, using xmlrpc. All other fields along with this object is being saved but not this object. Can you please guide me how to pass object in xmlrpc for openerp

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top