This question has been flagged
1 Reply
4248 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