Skip to Content
Menu
This question has been flagged
1 Reply
4465 Views

Hello, I have a field in crm.lead . Now when I want to create a customer I can give all values to the fields with this:

def _lead_create_contact(self, cr, uid, lead, name, is_company, parent_id=False, context=None):
 partner = self.pool.get('res.partner')
vals = {'name': name,
'user_id': lead.user_id.id,
'comment': lead.description,
'section_id': lead.section_id.id or False,
'parent_id': parent_id, 'phone': lead.phone,
'field1': lead.field1,
'type': 'contact' }
partner = partner.create(cr, uid, vals, context=context)
return partner


Now my field field1 is a many2many field . This value is not moved to the customer I create, all other values are moved.

How can I move a many2many value to an other many2many field in an other model?


thanks


I know that with (4, ID) link to existing record with id = ID (adds a relationship)

I can link to 1 record. But when I want link to more records in this many2many field I get this error:

ValueError Expected singleton: res.country(3, 6, 63, 12, 106, 29, 23)




Avatar
Discard
Best Answer

Try this:

[(4, x.id) for x in list]

Avatar
Discard
Related Posts Replies Views Activity
4
Jan 17
7235
5
Mar 16
8799
3
Aug 20
8848
0
Jun 20
2549
2
Sep 19
5002