Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
5231 Weergaven

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
Annuleer
Beste antwoord

Try this:

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
4
jan. 17
8549
5
mrt. 16
10250
3
aug. 20
9917
0
jun. 20
3416
2
sep. 19
6034