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.1 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. employees_range = fields.Many2one(comodel_name='crm.employees_range')
  9. employees_number = fields.Integer()
  10. def _lead_create_contact(self, cr, uid, lead, name, is_company,
  11. parent_id=False, context=None):
  12. """Propagate employees_range and employees_number to created partner.
  13. """
  14. partner_id = super(CrmLead, self)._lead_create_contact(
  15. cr, uid, lead, name, is_company, parent_id=parent_id,
  16. context=context)
  17. self.pool['res.partner'].write(
  18. cr, uid, partner_id, {
  19. 'employees_range': lead.employees_range.id,
  20. 'employees_number': lead.employees_number
  21. }, context=context)
  22. return partner_id