Skip to Content
Menu
This question has been flagged
2 Replies
2867 Views

Using the XML-RPC read method on the res.partner model in a multicompany database, I always get the property_payment_term_id value for the first company.

How can I get the value for the other companies ? The user used to authenticate the XML-RPC call is enabled to access all the companies in the database.

Avatar
Discard

Are you setting using force_company in the context on your call? Please share the code you are using in the future - otherwise readers have to guess how you are doing it and ask questions instead of providing answers.

Author Best Answer

How can I set the context with an RPC Call ? I dind't found any example in the documentation.

The code is something like this

import xmlrpc.client

models=xmlrpc.client.ServerProxy('http://demo.odoo.com/xmlrpc/2/object')

res=models.execute_kw(db,uid,password,'res.partner','read',['123456'],{'fields':['name','property_payment_term_id']})

Avatar
Discard
Author

Found the answer by myself:

res=models.execute_kw(db,uid,password,'res.partner','read',['123456'],{'fields':['name','property_payment_term_id'], 'context' : {'force_company':2} })

Related Posts Replies Views Activity
2
Jun 24
6258
2
Mar 24
342
1
Jan 24
1180
1
Jul 23
1676
1
Dec 22
7559