diff --git a/addons/note/note.py b/addons/note/note.py index 429c16eed6d..33d138de641 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 """ @@ -60,6 +61,10 @@ class note_note(osv.osv): rec_id = self.create(cr, uid, {'memo': name}, context=context) return self.name_get(cr, uid, [rec_id], context)[0] + def _from_xml(self, mappings): + return chr(int( mappings.group(1) )) + + #read the first line (convert hml into text) def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None): res = {} @@ -67,13 +72,14 @@ class note_note(osv.osv): text_note = (note.memo or '').strip().split('\n')[0] text_note = re.sub(r'(\S?)(|<[/]?p>|<[/]?div>|)[\s\S]*',r'\1',text_note) text_note = re.sub(r'<[^>]+>','',text_note) + text_note = html2plaintext(text_note) res[note.id] = text_note 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='This sticky note is active', subject=False, type='notification', parent_id=False, attachments=None, context=context) @@ -82,7 +88,7 @@ class note_note(osv.osv): #activate a Sticky 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='This sticky note is close', subject=False, type='notification', parent_id=False, attachments=None, context=context) @@ -124,7 +130,8 @@ class note_note(osv.osv): _columns = { 'name': fields.function(_get_note_first_line, string='Sticky note Summary', - type='text', store=True), + type='text', + store=True), 'memo': fields.html('Pad Content'), 'sequence': fields.integer('Sequence'), @@ -140,7 +147,7 @@ class note_note(osv.osv): # stage per user 'stage_ids': fields.many2many('note.stage','note_stage_rel','note_id','stage_id','Linked stages users'), - 'active': fields.boolean('Active'), + 'open': fields.boolean('Active'), # when the user unactivate the Sticky note, record de date for un display Sticky note after 1 days 'date_done': fields.date('Date done'), 'color': fields.integer('Color Index'), @@ -151,7 +158,7 @@ class note_note(osv.osv): } _defaults = { - 'active' : 1, + 'open' : 1, 'stage_id' : _get_default_stage_id, 'memo': " " } diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml index 88b21effb7e..8b76887e577 100644 --- a/addons/note/note_demo.xml +++ b/addons/note/note_demo.xml @@ -115,14 +115,5 @@ 7 - -
* Open ERP: a modern approach to integrated business management -
* Open ERP for Retail and Industrial Management - ]]> -
- -
- diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index 232b96f643a..5617fae4376 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -51,7 +51,7 @@ - + @@ -65,8 +65,8 @@
- W - è + W + è @@ -80,7 +80,7 @@
-
+
@@ -107,7 +107,7 @@ - + @@ -143,8 +143,9 @@ - - + + + @@ -188,7 +189,7 @@ form kanban,tree,form - {'search_default_active_true':True} + {'search_default_open_true':True} diff --git a/addons/note/security/ir.rule.xml b/addons/note/security/ir.rule.xml index 82994b960c2..5f4882c3048 100644 --- a/addons/note/security/ir.rule.xml +++ b/addons/note/security/ir.rule.xml @@ -1,12 +1,21 @@ + Only followers can access a sticky notes ['|',('message_follower_ids','=',False),('message_follower_ids','=',user.partner_id.id)] + + + Each user have his stage name + + ['|',('user_id','=',False),('user_id','=',user.id)] + + +