[IMP] cleaning notes, name_create

bzr revid: chm@openerp.com-20120914150854-1eh3nlzf2badxawr
This commit is contained in:
Christophe Matthieu
2012-09-14 17:08:54 +02:00
parent a15456ba0f
commit efae13456d
5 changed files with 48 additions and 53 deletions
+3
View File
@@ -52,6 +52,9 @@ Memos can be found in the 'Home' menu.
'demo': [
'note_demo.xml',
],
'test': [
'test/note_create.yml',
],
'css': [
'static/src/css/note.css',
],
+6 -6
View File
@@ -56,8 +56,9 @@ class note_note(osv.osv):
_description = "Sticky note"
#writing method (no modification of values)
def _set_note_first_line(self, cr, uid, id, name, value, args={}, context=None):
return self.write(cr, uid, [id], {'memo': value}, context=context)
def name_create(self, cr, uid, name, context=None):
rec_id = self.create(cr, uid, {'memo': name}, context=context)
return self.name_get(cr, uid, [rec_id], context)[0]
#read the first line (convert hml into text)
def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None):
@@ -119,12 +120,11 @@ class note_note(osv.osv):
result[record.id] = stage.id
return result
_columns = {
'name': fields.function(_get_note_first_line,
fnct_inv=_set_note_first_line,
string='Sticky note Summary',
type='text',
store=True),
type='text', store=True),
'memo': fields.html('Pad Content'),
'sequence': fields.integer('Sequence'),
@@ -144,7 +144,7 @@ class note_note(osv.osv):
# 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'),
# put tags on the memo (optional)
# put tags on the note (optional)
'tag_ids' : fields.many2many('note.tag','note_tags_rel','note_id','tag_id','Tags'),
'current_partner_id' : fields.function(_get_my_current_partner),
+2 -36
View File
@@ -3,6 +3,7 @@
<data>
<record id="note_1" model="note.note">
<field name="name">Customer report #349872</field>
<field name="memo"><![CDATA[Customer report #349872
<br/><br/>* Calendar app in Home
<br/>* The base_calendar module should create a menu in Home, like described above.
@@ -10,9 +11,7 @@
<br/>* We should use the term Calendar, not Meeting.
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_01"/>
<field name="user_id" ref="base.user_root"/>
<field name="color">2</field>
</record>
@@ -21,27 +20,21 @@
<br/><br/>* Followed by the telephone conversation and mail about D.544.3
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_01"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_3" model="note.note">
<field name="memo"><![CDATA[Call Marc
<br/><br/>]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_01"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_4" model="note.note">
<field name="memo"><![CDATA[Project N.947.5
<br/><br/>]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_02"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_5" model="note.note">
@@ -50,9 +43,7 @@
<br/>* wine
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_02"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_6" model="note.note">
@@ -61,9 +52,7 @@
it transforms the html editable memo text field into widget='pad', similar to project_pad depends on 'memo' and 'pad' modules
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_02"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_7" model="note.note">
@@ -72,9 +61,7 @@
<br/>* Open ERP for Retail and Industrial Management
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_8" model="note.note">
@@ -95,9 +82,7 @@
a big one, full of pixels, of course !
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
<field name="color">3</field>
</record>
@@ -107,9 +92,8 @@
<br/>* Open ERP for Retail and Industrial Management
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_02"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_10" model="note.note">
@@ -118,21 +102,7 @@
<br/>* Open ERP for Retail and Industrial Management
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="note_11" 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="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
<field name="color">5</field>
</record>
<record id="note_12" model="note.note">
@@ -141,9 +111,7 @@
<br/>* Open ERP for Retail and Industrial Management
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
<field name="color">7</field>
</record>
@@ -153,9 +121,7 @@
<br/>* Open ERP for Retail and Industrial Management
]]>
</field>
<field name="note_pad"></field>
<field name="stage_id" ref="note_stage_03"/>
<field name="user_id" ref="base.user_root"/>
</record>
</data>
+12 -11
View File
@@ -46,7 +46,7 @@
<field name="name">note.note.kanban</field>
<field name="model">note.note</field>
<field name="arch" type="xml">
<kanban default_group_by="stage_id" class="oe_notes" version="7.0">
<kanban default_group_by="stage_id" class="oe_notes oe_kanban_quickcreate_textarea" version="7.0">
<field name="color"/>
<field name="sequence"/>
<field name="name"/>
@@ -114,26 +114,28 @@
</field>
</record>
<!-- New memo Form View -->
<!-- New note Form View -->
<record model="ir.ui.view" id="view_note_note_form">
<field name="name">note.note.form</field>
<field name="model">note.note</field>
<field name="arch" type="xml">
<form string="Sticky note" version="7.0">
<header>
<field name="stage_id" domain="[('user_id','=',uid)]" widget="statusbar" clickable="1"/>
<field name="stage_id" domain="[('user_id','=',uid)]" widget="statusbar" clickable="1"/>
</header>
<field colspan="4" name="memo" widget="html" editor_width="100%%" editor_height="100%%" nolabel="1"/>
<field colspan="4" 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" groups="note.group_note_thread"/>
<span groups="note.group_note_thread">
<field class="oe_chatter" name="message_ids" widget="mail_thread"/>
</span>
</form>
</field>
</record>
<!-- Search memo -->
<!-- Search note -->
<record model="ir.ui.view" id="view_note_note_filter">
<field name="name">note.note.search</field>
<field name="model">note.note</field>
@@ -146,8 +148,7 @@
<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)]"/>
<group expand="0" string="Group By...">
<filter icon="terp-personal" string="Creator" help="By Creators" context="{'group_by':'create_uid'}"/>
<filter icon="terp-stock_symbol-selection" string="Stage" help="By memo Category" context="{'group_by':'stage_id'}"/>
<filter icon="terp-stock_symbol-selection" string="Stage" help="By sticky note Category" context="{'group_by':'stage_id'}"/>
</group>
</search>
</field>
@@ -186,9 +187,9 @@
</field>
</record>
<!-- memo Action -->
<!-- Action -->
<record model="ir.actions.act_window" id="action_note_note">
<field name="name">Memos</field>
<field name="name">Sticky notes</field>
<field name="res_model">note.note</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
@@ -196,7 +197,7 @@
<field name="context">{'search_default_active_true':True}</field>
</record>
<menuitem name="Memos" id="note_notes" parent="note_my_stuff" sequence="20" action="action_note_note"/>
<menuitem name="Sticky notes" id="note_notes" parent="note_my_stuff" sequence="20" action="action_note_note"/>
</data>
</openerp>
+25
View File
@@ -0,0 +1,25 @@
-
I create a stage
-
!record {model: note.stage, id: note_stage_1}:
name: 'first stage'
user_id: 1
-
I create a stage for an other user
-
!record {model: note.stage, id: note_stage_2}:
name: 'second stage'
user_id: 2
-
I create a sticky note with 2 tags and 2 stages
-
!record {model: note.note, id: note_1}:
name: 'My second note'
memo: 'My second note content'
color: 2
stage_ids:
- stage_id: note_stage.note_stage_1
- stage_id: note_stage.note_stage_2
tag_ids:
- name: 'first tag'
- name: 'second tad'