diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-19 08:42:35 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-19 08:42:35 +0200 |
| commit | 819455b73cbc336142579c788445b4d4734bd83f (patch) | |
| tree | 2880b18c883173cdd5f327e03b89997ff6aec2eb /addons/note | |
| parent | bd1dc47bbec6f980f3bee1d960bff8b15d8612fd (diff) | |
| parent | ab8722f1b4d4de2aacc7e42a77ce08cb141ab86e (diff) | |
[IMP] Merging notes from chm
bzr revid: fp@tinyerp.com-20120919064235-rt1p93km8oxum8cp
Diffstat (limited to 'addons/note')
| -rw-r--r-- | addons/note/note.py | 12 | ||||
| -rw-r--r-- | addons/note/note_demo.xml | 9 | ||||
| -rw-r--r-- | addons/note/note_view.xml | 21 | ||||
| -rw-r--r-- | addons/note/security/ir.rule.xml | 19 |
4 files changed, 29 insertions, 32 deletions
diff --git a/addons/note/note.py b/addons/note/note.py index 65848ed7828..a7bad7f6a55 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 """ @@ -65,23 +66,24 @@ class note_note(osv.osv): 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) + 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='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) @@ -119,14 +121,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' diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml index 82601f903c0..1cc1b2fc790 100644 --- a/addons/note/note_demo.xml +++ b/addons/note/note_demo.xml @@ -138,14 +138,5 @@ <field name="color">7</field> </record> - <record id="note_13" model="note.note"> - <field name="memo"><![CDATA[Read those books - <br/><br/>* Open ERP: a modern approach to integrated business management - <br/>* Open ERP for Retail and Industrial Management - ]]> - </field> - <field name="stage_id" ref="note_stage_03"/> - </record> - </data> </openerp> diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index 1166e687750..ccb07544c09 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> <openerp> <data> - <menuitem name="Organizer" id="note_my_stuff" parent="mail.mail_feeds_main"/> <!-- note Stage Form View --> @@ -51,7 +50,7 @@ <field name="sequence"/> <field name="name"/> <field name="stage_id"/> - <field name="active"/> + <field name="open"/> <field name="memo"/> <field name="date_done"/> <field name="current_partner_id"/> @@ -65,8 +64,8 @@ <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_global_click_edit oe_semantic_html_override oe_kanban_card #{record.group_fancy==1 ? 'oe_kanban_card_fancy' : ''}"> <div class="oe_dropdown_kanban"> <span> - <a name="onclick_note_is_done" type="object" t-if="record.active.raw_value" class="oe_e">W</a> - <a name="onclick_note_not_done" type="object" t-if="!record.active.raw_value" class="oe_e">è</a> + <a name="onclick_note_is_done" type="object" t-if="record.open.raw_value" class="oe_e">W</a> + <a name="onclick_note_not_done" type="object" t-if="!record.open.raw_value" class="oe_e">è</a> </span> <!-- dropdown menu --> @@ -78,13 +77,12 @@ </ul> </div> </div> - <!-- kanban note --> - <div t-attf-class="oe_kanban_content #{record.active.raw_value ? '' : 'note_text_line_through'}"> + <div t-attf-class="oe_kanban_content #{record.open.raw_value ? '' : 'note_text_line_through'}"> <!-- title --> <field name="name"/> </div> - <div widget="many2many_tags" t-att-data="record.tag_ids.raw_value" model="note.tag"/> + <field name="tag_ids"/> <div class="oe_right"> <t t-foreach="record.message_follower_ids.raw_value" t-as="follower"> <img t-if="record.current_partner_id.raw_value!=follower" t-att-src="kanban_image('res.partner', 'image_small', follower)" width="24" height="24" class="oe_kanban_avatar" t-att-data-member_id="follower"/> @@ -105,7 +103,7 @@ <field name="arch" type="xml"> <tree string="Stages"> <field name="name"/> - <field name="active"/> + <field name="open"/> <field name="stage_id"/> <field name="tag_ids" widget="many2many_tags" groups="note.group_note_tags"/> </tree> @@ -139,9 +137,8 @@ <search string="Notes"> <field name="memo" string="Note"/> <field name="tag_ids" groups="note.group_note_tags"/> - <field name="stage_id"/> - <filter name="active_true" string="Active" domain="['|',('active', '=', True),('date_done','=',time.strftime('%%Y-%%m-%%d'))]"/> - <filter name="active_false" string="Old" domain="[('active', '=', False)]"/> + <filter name="open_true" string="Active" domain="['|',('open', '=', True),('date_done','=',time.strftime('%%Y-%%m-%%d'))]"/> + <filter name="open_false" string="Archive" domain="[('open', '=', False)]"/> <group expand="0" string="Group By..."> <filter icon="terp-stock_symbol-selection" string="Stage" help="By sticky note Category" context="{'group_by':'stage_id'}"/> </group> @@ -185,7 +182,7 @@ <field name="view_type">form</field> <field name="view_mode">kanban,tree,form</field> <field name="search_view_id" ref="view_note_note_filter"/> - <field name="context">{'search_default_active_true':True}</field> + <field name="context">{'search_default_open_true':True}</field> </record> <menuitem name="Notes" id="note_notes" parent="note_my_stuff" sequence="20" action="action_note_note"/> diff --git a/addons/note/security/ir.rule.xml b/addons/note/security/ir.rule.xml index 3d2f0d242f6..1195314cc9e 100644 --- a/addons/note/security/ir.rule.xml +++ b/addons/note/security/ir.rule.xml @@ -1,12 +1,19 @@ <?xml version="1.0"?> <openerp> <data> - <record id="note_note_rule_global" model="ir.rule"> - <field name="name">Only followers can access a sticky notes</field> - <field model="ir.model" ref="model_note_note" name="model_id"/> - <field name="domain_force">['|',('message_follower_ids','=',False),('message_follower_ids','=',user.partner_id.id)]</field> - <field eval="True" name="global"/> - </record> + <record id="note_note_rule_global" model="ir.rule"> + <field name="name">Only followers can access a sticky notes</field> + <field model="ir.model" ref="model_note_note" name="model_id"/> + <field name="domain_force">[('message_follower_ids','=',user.partner_id.id)]</field> + <field eval="True" name="global"/> + </record> + + <record id="note_stage_rule_global" model="ir.rule"> + <field name="name">Each user have his stage name</field> + <field model="ir.model" ref="model_note_stage" name="model_id"/> + <field name="domain_force">['|',('user_id','=',False),('user_id','=',user.id)]</field> + <field eval="True" name="global"/> + </record> </data> </openerp> |
