Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2015
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. def _lead_create_contact(self, cr, uid, lead, name, is_company, parent_id=False, context=None):
  2. partner = self.pool.get('res.partner')
  3. vals = {'name': name,
  4. 'user_id': lead.user_id.id,
  5. 'comment': lead.description,
  6. 'section_id': lead.section_id.id or False,
  7. 'parent_id': parent_id,
  8. 'phone': lead.phone,
  9. 'mobile': lead.mobile,
  10. #'email': tools.email_split(lead.email_from) and tools.email_split(lead.email_from)[0] or False,
  11. 'email': 'hello world',
  12. 'fax': lead.fax,
  13. 'title': lead.title and lead.title.id or False,
  14. 'function': lead.function,
  15. 'street': lead.street,
  16. 'street2': lead.street2,
  17. 'zip': lead.zip,
  18. 'city': lead.city,
  19. 'country_id': lead.country_id and lead.country_id.id or False,
  20. 'state_id': lead.state_id and lead.state_id.id or False,
  21. 'is_company': is_company,
  22.  
  23. # add custom fields mapping
  24.  
  25. 'x_havesap': lead.x_hassap,
  26. 'x_branch': lead.x_branch,
  27. 'x_countperson': lead.x_countperson,
  28. 'x_turnover': lead.x_turnover,
  29.  
  30. # add custom fields mapping
  31.  
  32. 'type': 'contact'
  33. }
  34. partner = partner.create(cr, uid, vals, context=context)
  35. return partner
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement