You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.0 KiB

  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. # For copyright and license notices, see __openerp__.py file in root directory
  4. ##############################################################################
  5. from openerp import models, fields
  6. class CrmLead(models.Model):
  7. _inherit = 'crm.lead'
  8. function = fields.Char(string="Detailed job position")
  9. job_position = fields.Many2one(comodel_name='crm.job_position',
  10. string="Job position")
  11. def _lead_create_contact(self, cr, uid, lead, name, is_company,
  12. parent_id=False, context=None):
  13. """
  14. Propagate job_position to created partner.
  15. """
  16. partner_id = super(CrmLead, self)._lead_create_contact(
  17. cr, uid, lead, name, is_company, parent_id=parent_id,
  18. context=context)
  19. self.pool['res.partner'].write(
  20. cr, uid, partner_id, {'job_position': lead.job_position.id},
  21. context=context)
  22. return partner_id