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

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?


Avatar
Discard
Best Answer

Hi,

Try this,

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

Regards

Avatar
Discard
Author Best Answer

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'>



Avatar
Discard