J.C
J.C

Reputation: 75

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

I got an error like this:

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

This is the code:

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

What's the problem?

Upvotes: 2

Views: 4801

Answers (2)

Sudhir Arya
Sudhir Arya

Reputation: 3743

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.

Upvotes: 1

OmaL
OmaL

Reputation: 5044

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)

Upvotes: 3

Related Questions