summaryrefslogtreecommitdiff
path: root/addons/note/note.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-12-19 14:28:39 +0100
committerThibault Delavallée <tde@openerp.com>2013-12-19 14:28:39 +0100
commit60123bebbe094002e0f875df0ee7835c38ec587f (patch)
tree083cf09965e0735a009e72e80d51400433626058 /addons/note/note.py
parentaa81e66039faf8959bbe1ebe593f0c11470bac66 (diff)
[FIX] note: fixed note creation.
When creating a new note, a function field requires to browse the note in order to get the stages. However the basic rule for creating a note is to be in the followers. As followers is another field set during the creation, we are not sure uid is already in the followers of the note when reading it. We therefore do it as SUPERUSER_ID, because it is only to have access to some technical data of the note. bzr revid: tde@openerp.com-20131219132839-m0a5rv0znhliqbq1
Diffstat (limited to 'addons/note/note.py')
-rw-r--r--addons/note/note.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/note/note.py b/addons/note/note.py
index 00c67c37191..fe917531472 100644
--- a/addons/note/note.py
+++ b/addons/note/note.py
@@ -84,9 +84,10 @@ class note_note(osv.osv):
return ids and ids[0] or False
def _set_stage_per_user(self, cr, uid, id, name, value, args=None, context=None):
- note = self.browse(cr, uid, id, context=context)
- if not value: return False
- stage_ids = [value] + [stage.id for stage in note.stage_ids if stage.user_id.id != uid ]
+ if not value:
+ return False
+ note = self.browse(cr, SUPERUSER_ID, id, context=context) # do it as SUPERUSER because when creating, followers are not necessariliry set (another function field)
+ stage_ids = [value] + [stage.id for stage in note.stage_ids if stage.user_id.id != uid]
return self.write(cr, uid, [id], {'stage_ids': [(6, 0, set(stage_ids))]}, context=context)
def _get_stage_per_user(self, cr, uid, ids, name, args, context=None):