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.

28 lines
1.2 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. def _lead_create_contact(self, cr, uid, lead, name, is_company,
  13. parent_id=False, context=None):
  14. """Propagate capital_country and capital_registered 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, {
  21. 'capital_country': lead.capital_country.id,
  22. 'capital_registered': lead.capital_registered
  23. }, context=context)
  24. return partner_id