Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5190 Представления

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)




Аватар
Отменить
Лучший ответ

Try this:

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
янв. 17
8485
5
мар. 16
10195
3
авг. 20
9825
0
июн. 20
3370
2
сент. 19
5991