flectra/addons/note/models/res_users.py

22 lines
670 B
Python
Raw Normal View History

# -*- 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 11:34:37 +01:00
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