diff options
| author | Jiten (OpenERP) <jra@tinyerp.com> | 2012-09-20 13:39:35 +0530 |
|---|---|---|
| committer | Jiten (OpenERP) <jra@tinyerp.com> | 2012-09-20 13:39:35 +0530 |
| commit | f5f1a47c24e0176a3ed3d0bdb7528cf8ce8d4f89 (patch) | |
| tree | 99845ab2872f716d34db8826dfd75a20d1a32bd9 /addons/note | |
| parent | 29ca700beb96d904e9798e08e52dd4b6b5754b5d (diff) | |
| parent | 8e6135b43a2c38785c0575d142da4004224174f8 (diff) | |
[MERGE] Merged trunk.
bzr revid: jra@tinyerp.com-20120920080935-2y2cfc18e65g7a4y
Diffstat (limited to 'addons/note')
| -rw-r--r-- | addons/note/__openerp__.py | 6 | ||||
| -rw-r--r-- | addons/note/note.py | 20 | ||||
| -rw-r--r-- | addons/note/note_demo.xml | 31 | ||||
| -rw-r--r-- | addons/note/note_view.xml | 32 | ||||
| -rw-r--r-- | addons/note/security/ir.rule.xml | 19 |
5 files changed, 49 insertions, 59 deletions
diff --git a/addons/note/__openerp__.py b/addons/note/__openerp__.py index 7d6cac5b85b..2c6134e5e3a 100644 --- a/addons/note/__openerp__.py +++ b/addons/note/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## { - 'name': 'Memos', + 'name': 'Notes', 'version': '1.0', 'category': 'Tools', 'description': """ @@ -28,12 +28,12 @@ This module allows users to create their own notes inside OpenERP ================================================================= Use notes to write meeting minutes, organize ideas, organize personnal todo -lists, etc. Each user manages his own personnal memos. Notes are available to +lists, etc. Each user manages his own personnal Notes. Notes are available to their authors only, but they can share notes to others users so that several people can work on the same note in real time. It's very efficient to share meeting minutes. -Memos can be found in the 'Home' menu. +Notes can be found in the 'Home' menu. """, 'author': 'OpenERP SA', 'website': 'http://openerp.com', 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' diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml index 82601f903c0..16fa5a3f66b 100644 --- a/addons/note/note_demo.xml +++ b/addons/note/note_demo.xml @@ -28,7 +28,7 @@ <record id="note_1" model="note.note"> <field name="name">Customer report #349872</field> - <field name="memo"><![CDATA[Customer report #349872 + <field name="memo"><![CDATA[<b>Customer report #349872</b> <br/><br/>* Calendar app in Home <br/>* The base_calendar module should create a menu in Home, like described above. <br/>* This module should become a main application (in the first screen at installation) @@ -40,7 +40,7 @@ </record> <record id="note_2" model="note.note"> - <field name="memo"><![CDATA[Call Fabien + <field name="memo"><![CDATA[<b>Call Fabien</b> <br/><br/>* Followed by the telephone conversation and mail about D.544.3 ]]> </field> @@ -48,21 +48,21 @@ </record> <record id="note_3" model="note.note"> - <field name="memo"><![CDATA[Call Marc + <field name="memo"><![CDATA[<b>Call Marc</b> <br/><br/>]]> </field> <field name="stage_id" ref="note_stage_01"/> </record> <record id="note_4" model="note.note"> - <field name="memo"><![CDATA[Project N.947.5 + <field name="memo"><![CDATA[<b>Project N.947.5</b> <br/><br/>]]> </field> <field name="stage_id" ref="note_stage_02"/> </record> <record id="note_5" model="note.note"> - <field name="memo"><![CDATA[Shop for family dinner + <field name="memo"><![CDATA[<b>Shop for family dinner</b> <br/>* stuffed turkey <br/>* wine ]]> @@ -71,7 +71,7 @@ </record> <record id="note_6" model="note.note"> - <field name="memo"><![CDATA[Idea to develop + <field name="memo"><![CDATA[<b>Idea to develop</b> <br/><br/>* Create a module note_pad it transforms the html editable memo text field into widget='pad', similar to project_pad depends on 'memo' and 'pad' modules ]]> @@ -80,7 +80,7 @@ </record> <record id="note_7" model="note.note"> - <field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code + <field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b> <br/><br/>* Open ERP: a modern approach to integrated business management <br/>* Open ERP for Retail and Industrial Management ]]> @@ -89,7 +89,7 @@ </record> <record id="note_8" model="note.note"> - <field name="memo"><![CDATA[New computer specs + <field name="memo"><![CDATA[<b>New computer specs</b> <br/><br/>* Motherboard according to processor <br/>* Processor @@ -111,7 +111,7 @@ </record> <record id="note_9" model="note.note"> - <field name="memo"><![CDATA[Read those books + <field name="memo"><![CDATA[<b>Read those books</b> <br/><br/>* Open ERP: a modern approach to integrated business management <br/>* Open ERP for Retail and Industrial Management ]]> @@ -120,7 +120,7 @@ </record> <record id="note_10" model="note.note"> - <field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code + <field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b> <br/><br/>* Open ERP: a modern approach to integrated business management <br/>* Open ERP for Retail and Industrial Management ]]> @@ -129,7 +129,7 @@ </record> <record id="note_12" model="note.note"> - <field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code + <field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b> <br/><br/>* Open ERP: a modern approach to integrated business management <br/>* Open ERP for Retail and Industrial Management ]]> @@ -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..8d943dde44d 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -1,9 +1,6 @@ <?xml version="1.0"?> <openerp> <data> - - <menuitem name="Organizer" id="note_my_stuff" parent="mail.mail_feeds_main"/> - <!-- note Stage Form View --> <record model="ir.ui.view" id="view_note_stage_form"> <field name="name">note.stage.form</field> @@ -39,8 +36,6 @@ <field name="domain">[('user_id','=',uid)]</field> </record> - <menuitem name="Categories" id="menu_notes_stage" parent="note_my_stuff" action="action_note_stage" sequence="40" groups="base.group_no_one"/> - <!-- New note Kanban View --> <record model="ir.ui.view" id="view_note_note_kanban"> <field name="name">note.note.kanban</field> @@ -51,7 +46,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 +60,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 +73,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 +99,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> @@ -119,12 +113,10 @@ <field name="arch" type="xml"> <form string="Note" version="7.0"> <header> + <field name="tag_ids" widget="many2many_tags" class="oe_inline" placeholder="Tags"/> <field name="stage_id" domain="[('user_id','=',uid)]" widget="statusbar" clickable="1"/> </header> <field name="memo" widget="html"/><!-- editor_width="100%%" editor_height="60%%" --> - <group groups="note.group_note_tags" col="2"> - <field name="tag_ids" widget="many2many_tags"/> - </group> <field name="message_follower_ids" widget="mail_followers"/> <field class="oe_chatter" name="message_ids" widget="mail_thread"/> </form> @@ -139,9 +131,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,10 +176,11 @@ <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"/> + <menuitem name="Notes" id="menu_note_notes" parent="mail.mail_my_stuff" sequence="20" action="note.action_note_note"/> + <menuitem name="Categories" id="menu_notes_stage" parent="mail.mail_my_stuff" action="note.action_note_stage" sequence="21" groups="base.group_no_one"/> </data> </openerp> 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> |
