summaryrefslogtreecommitdiff
path: root/addons/note/note.py
diff options
context:
space:
mode:
authorJiten (OpenERP) <jra@tinyerp.com>2012-09-20 13:39:35 +0530
committerJiten (OpenERP) <jra@tinyerp.com>2012-09-20 13:39:35 +0530
commitf5f1a47c24e0176a3ed3d0bdb7528cf8ce8d4f89 (patch)
tree99845ab2872f716d34db8826dfd75a20d1a32bd9 /addons/note/note.py
parent29ca700beb96d904e9798e08e52dd4b6b5754b5d (diff)
parent8e6135b43a2c38785c0575d142da4004224174f8 (diff)
[MERGE] Merged trunk.
bzr revid: jra@tinyerp.com-20120920080935-2y2cfc18e65g7a4y
Diffstat (limited to 'addons/note/note.py')
-rw-r--r--addons/note/note.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/addons/note/note.py b/addons/note/note.py
index 65848ed7828..fb3f0cee853 100644
--- a/addons/note/note.py
+++ b/addons/note/note.py
@@ -22,6 +22,7 @@
from openerp.osv import osv, fields
from tools.translate import _
import re
+from openerp.tools.misc import html2plaintext
class note_stage(osv.osv):
""" Category of Note """
@@ -62,26 +63,24 @@ class note_note(osv.osv):
def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None):
res = {}
for note in self.browse(cr, uid, ids, context=context):
- text_note = (note.memo or '').strip().split('\n')[0]
- text_note = re.sub(r'(\S?)(<br[ /]*>|<[/]?p>|<[/]?div>|<table>)[\s\S]*',r'\1',text_note)
- text_note = re.sub(r'<[^>]+>','',text_note)
- res[note.id] = text_note
+ res[note.id] = (note.memo and html2plaintext(note.memo) or "").strip().replace('*','').split("\n")[0]
+
return res
#unactivate a sticky note and record the date
def onclick_note_is_done(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'active' : False, 'date_done' : fields.date.today() })
+ self.write(cr, uid, ids, { 'open' : False, 'date_done' : fields.date.today() })
self.message_post(cr, uid, ids[0], body='Note is done.', subject=False,
type='notification', parent_id=False, attachments=None, context=context)
return False
#activate a note
def onclick_note_not_done(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'active' : True})
+ self.write(cr, uid, ids, {'open' : True})
self.message_post(cr, uid, ids[0], body='Note has been activated.', subject=False,
type='notification', parent_id=False, attachments=None, context=context)
return False
-
+
#used for undisplay the follower if it's the current user
def _get_my_current_partner(self, cr, uid, ids, name, args, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
@@ -96,7 +95,8 @@ class note_note(osv.osv):
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
- return self.write(cr, uid, [id], {'stage_ids': [(4, value)]}, context=context)
+ 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, stage_ids)]}, context=context)
def _get_stage_per_user(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)
@@ -119,14 +119,14 @@ class note_note(osv.osv):
type='many2one',
relation='note.stage'),
'stage_ids': fields.many2many('note.stage','note_stage_rel','note_id','stage_id','Stages of Users'),
- 'active': fields.boolean('Active'),
+ 'open': fields.boolean('Active'),
'date_done': fields.date('Date done'),
'color': fields.integer('Color Index'),
'tag_ids' : fields.many2many('note.tag','note_tags_rel','note_id','tag_id','Tags'),
'current_partner_id' : fields.function(_get_my_current_partner),
}
_defaults = {
- 'active' : 1,
+ 'open' : 1,
'stage_id' : _get_default_stage_id,
}
_order = 'sequence'