2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Users(models.Model):
|
|
|
|
|
|
|
|
_name = 'res.users'
|
|
|
|
_inherit = ['res.users']
|
|
|
|
|
|
|
|
@api.model
|
|
|
|
def create(self, values):
|
|
|
|
user = super(Users, self).create(values)
|
|
|
|
# for new employee, create his own 5 base note stages
|
|
|
|
if user.has_group('base.group_user'):
|
|
|
|
for num in range(5):
|
|
|
|
stage = self.env.ref('note.note_stage_%02d' % (num,), raise_if_not_found=False)
|
|
|
|
if stage:
|
|
|
|
stage.sudo().copy(default={'user_id': user.id})
|
|
|
|
return user
|