跳至内容
菜单
此问题已终结
2 回复
3929 查看

Hi there

How do I add context to a write or create method via the XML RPC webservice

for example I would like to add:

 {'context': [['lang', 'nl_BE']]}


Is there a way to do this?


形象
丢弃
最佳答案

Hi,

Try this,

api.execute_kw(db, uid, pwd, 'res.country', 'write', [[]], {'fields': ['id', 'name'], 'context' :{'lang': 'nl_BE'})

Regards

形象
丢弃
编写者 最佳答案

Hi there. Thanks for your answer

but it doesn't work.


This works: 

models.execute_kw(self.dbName, self.uid, self.dbPassword, 'res.country', 'write', [[45],{'name':'Cook eilanden'}])

But this doesn't work:

self.models.execute_kw(self.dbName, self.uid, self.dbPassword, 'res.country', 'write', [[45],{'name':'Cook eilanden'}], {'fields': ['id', 'name'], 'context' :{'lang': 'nl_BE'}})

= method(recs, *args, **kwargs)\nTypeError: Country.write() got an unexpected keyword argument \'fields\'\n'>



形象
丢弃