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.

23 lines
816 B

  1. # -*- coding: utf-8 -*-
  2. # (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
  3. # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
  4. # © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
  5. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  6. from openerp import models, api
  7. class ResUsers(models.Model):
  8. _inherit = "res.users"
  9. @api.model
  10. def _signup_create_user(self, values):
  11. account_type = values.pop('account_type', False)
  12. res = super(ResUsers, self)._signup_create_user(values)
  13. if isinstance(res, int):
  14. user = self.env['res.users'].browse(res)
  15. if account_type == 'supplier':
  16. user.partner_id.supplier = True
  17. user.groups_id |= self.env.ref(
  18. 'auth_supplier.group_auth_supplier')
  19. return res