summaryrefslogtreecommitdiff
path: root/addons/note/note.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-10-28 17:33:21 +0100
committerThibault Delavallée <tde@openerp.com>2013-10-28 17:33:21 +0100
commit5bb4fa2b4347a99b5c1a5722d5591c06f7032d4c (patch)
treeba5127daf27cc553ebc8683a39b68ebec379f4e9 /addons/note/note.py
parent0db0f20bda410bd6601c266026363fc95b21c9c4 (diff)
parenta7ff75f94a168e26b9e9a208167b07d45dc751cb (diff)
[MERGE] Sync with trunk
bzr revid: tde@openerp.com-20131028163321-5o81wa1m7rzdp1dz
Diffstat (limited to 'addons/note/note.py')
-rw-r--r--addons/note/note.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/addons/note/note.py b/addons/note/note.py
index eb9a6397d18..95fe8f97cdf 100644
--- a/addons/note/note.py
+++ b/addons/note/note.py
@@ -19,6 +19,7 @@
#
##############################################################################
+from openerp import SUPERUSER_ID
from openerp.osv import osv, fields
from openerp.tools import html2plaintext
@@ -188,18 +189,15 @@ class res_users(osv.Model):
_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_00','note_stage_01','note_stage_02','note_stage_03','note_stage_04']:
+ note_obj = self.pool['note.stage']
+ data_obj = self.pool['ir.model.data']
+ is_employee = self.has_group(cr, user_id, 'base.group_user')
+ if is_employee:
+ for n in range(5):
+ xmlid = 'note_stage_%02d' % (n,)
try:
- data_id = data_obj._get_id(cr, uid, 'note', note_xml_id)
+ _model, stage_id = data_obj.get_object_reference(cr, SUPERUSER_ID, 'note', xmlid)
except ValueError:
continue
- 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)
+ note_obj.copy(cr, SUPERUSER_ID, stage_id, default={'user_id': user_id}, context=context)
return user_id