flectra/addons/note/models/res_users.py
2018-01-16 02:34:37 -08:00

22 lines
670 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
from flectra import api, models
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