diff options
| author | Denis Ledoux dle@openerp.com <> | 2012-11-08 10:28:38 +0100 |
|---|---|---|
| committer | Denis Ledoux dle@openerp.com <> | 2012-11-08 10:28:38 +0100 |
| commit | 981168dfc6d628c72d8469022c0b51e0f5ec00df (patch) | |
| tree | e7497e1366dcd0b7759ed6eae9d2fa8b50ff46c5 /addons/note/note.py | |
| parent | 9e56b3b6a8a761e02099146b338225d29dbc8c8a (diff) | |
| parent | 29fffbc97d8970513114b7b76763f002aa73e395 (diff) | |
[ADD][MERGE]Add functionnalities, merge with trunk
bzr revid: dle@openerp.com-20121108092838-fe89ohg9za3ln6y1
Diffstat (limited to 'addons/note/note.py')
| -rw-r--r-- | addons/note/note.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/addons/note/note.py b/addons/note/note.py index 9d62f7a2cb7..fe5eca5efd7 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -29,7 +29,7 @@ class note_stage(osv.osv): _name = "note.stage" _description = "Note Stage" _columns = { - 'name': fields.char('Stage Name', required=True), + 'name': fields.char('Stage Name', translate=True, required=True), 'sequence': fields.integer('Sequence', help="Used to order the note stages"), 'user_id': fields.many2one('res.users', 'Owner', help="Owner of the note stage.", required=True), 'fold': fields.boolean('Folded by Default'), @@ -186,3 +186,21 @@ class note_base_config_settings(osv.osv_memory): 'module_note_pad': fields.boolean('Use collaborative pads (etherpad)'), 'group_note_fancy': fields.boolean('Use fancy layouts for notes', implied_group='note.group_note_fancy'), } + +class res_users(osv.Model): + _name = 'res.users' + _inherit = ['res.users'] + def create(self, cr, uid, data, context=None): + user_id = super(res_users, self).create(cr, uid, data, context=context) + user = self.browse(cr, uid, uid, context=context) + note_obj = self.pool.get('note.stage') + data_obj = self.pool.get('ir.model.data') + model_id = data_obj.get_object_reference(cr, uid, 'base', 'group_user') #Employee Group + group_id = model_id and model_id[1] or False + if group_id in [x.id for x in user.groups_id]: + for note_xml_id in ['note_stage_01','note_stage_02','note_stage_03','note_stage_04']: + data_id = data_obj._get_id(cr, uid, 'note', note_xml_id) + stage_id = data_obj.browse(cr, uid, data_id, context=context).res_id + note_obj.copy(cr, uid, stage_id, default = { + 'user_id': user_id}, context=context) + return user_id
\ No newline at end of file |
