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.

32 lines
1.4 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. def _lead_create_contact(self, cr, uid, lead, name, is_company,
  15. parent_id=False, context=None):
  16. """Propagate capital_country and capital_registered to created partner.
  17. """
  18. partner_id = super(CrmLead, self)._lead_create_contact(
  19. cr, uid, lead, name, is_company, parent_id=parent_id,
  20. context=context)
  21. self.pool['res.partner'].write(
  22. cr, uid, partner_id, {
  23. 'capital_country': lead.capital_country.id,
  24. 'capital_registered': lead.capital_registered,
  25. 'turnover_range': lead.turnover_range.id,
  26. 'turnover_number': lead.turnover_number,
  27. }, context=context)
  28. return partner_id