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.

37 lines
1.6 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. capital_country = fields.Many2one(
  9. 'res.country', string="Capital country",
  10. help="Country of origin of the capital of this company")
  11. capital_registered = fields.Integer(string="Capital registered")
  12. turnover_range = fields.Many2one(comodel_name='crm.turnover_range')
  13. turnover_number = fields.Integer()
  14. company_size = fields.Selection(
  15. string="Company size",
  16. selection=[('micro', 'Micro'), ('small', 'Small'),
  17. ('medium', 'Medium'), ('big', 'Big')])
  18. def _lead_create_contact(self, cr, uid, lead, name, is_company,
  19. parent_id=False, context=None):
  20. """Propagate capital_country and capital_registered to created partner.
  21. """
  22. partner_id = super(CrmLead, self)._lead_create_contact(
  23. cr, uid, lead, name, is_company, parent_id=parent_id,
  24. context=context)
  25. self.pool['res.partner'].write(
  26. cr, uid, partner_id, {
  27. 'capital_country': lead.capital_country.id,
  28. 'capital_registered': lead.capital_registered,
  29. 'turnover_range': lead.turnover_range.id,
  30. 'turnover_number': lead.turnover_number,
  31. 'company_size': lead.company_size,
  32. }, context=context)
  33. return partner_id