I have made a new field in the model 'crm.lead'
Now when I make a chance I can select -> create new partner. and all the standard odoo fields like phone, email etc. will convert in the partner that creates.
How can I put the value in my new field in the partner the same way. I have made the same field in crm.lead and res.partner.
ok I have found the function:
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,
'mobile': lead.mobile,
'email': tools.email_split(lead.email_from) and tools.email_split(lead.email_from)[0] or False,
'fax': lead.fax,
'title': lead.title and lead.title.id or False,
'function': lead.function,
'street': lead.street,
'street2': lead.street2,
'zip': lead.zip,
'city': lead.city,
'country_id': lead.country_id and lead.country_id.id or False,
'state_id': lead.state_id and lead.state_id.id or False,
'is_company': is_company,
'type': 'contact' }
partner = partner.create(cr, uid, vals, context=context)
return partner
Now How can I add there a many2many field?
I found this on crm_lead.py:
CRM_LEAD_FIELDS_TO_MERGE = ['name',
'partner_id',
'campaign_id',
'company_id',
'country_id',
'section_id',
'state_id',
'stage_id',
'medium_id',
'source_id',
'user_id',
'title',
'city',
'contact_name',
'description',
'email',
'fax',
'mobile',
'partner_name',
'phone',
'probability',
'planned_revenue',
'street',
'street2',
'zip',
'create_date',
'date_action_last',
'date_action_next',
'email_from',
'email_cc',
'partner_name']
Have anyone a idea?
Thank you.