TypeError: create() got multiple values for keyword argument 'context'

匿名 (未验证) 提交于 2019-12-03 09:02:45

问题:

I got an error like this:

This is the code:

mov_id = self.create(cr, uid, ids, {'so_ids':so, 'product_ids':product},context=context) 

What's the problem?

回答1:

To create a record, the parameters are cursor, user_id, dictionary of values and context. for example

mov_id = self.create(cr, uid, {'so_ids': so, 'product_ids': product},context=context) 

create doesnt take any ids, if you are trying to use copy, then use

mov_id = self.copy(cr, uid, ids, {'so_ids':so, 'product_ids':product},context=context) 


回答2:

self.create(cr, uid, {'so_ids':"Test"}, context=context)

This is the syntax for create method.

If you want to add 'write_uid' just add {'write_uid': ur_id} in dictionary in create method. In create method no 'id' or 'list of ids' is required.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!