From efae13456dfcf3601c60bce0e0028a64f6af3577 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 14 Sep 2012 17:08:54 +0200 Subject: [PATCH] [IMP] cleaning notes, name_create bzr revid: chm@openerp.com-20120914150854-1eh3nlzf2badxawr --- addons/note/__openerp__.py | 3 +++ addons/note/note.py | 12 +++++----- addons/note/note_demo.xml | 38 ++------------------------------ addons/note/note_view.xml | 23 ++++++++++--------- addons/note/test/note_create.yml | 25 +++++++++++++++++++++ 5 files changed, 48 insertions(+), 53 deletions(-) create mode 100644 addons/note/test/note_create.yml diff --git a/addons/note/__openerp__.py b/addons/note/__openerp__.py index 02e4653031c..eeaae7a5904 100644 --- a/addons/note/__openerp__.py +++ b/addons/note/__openerp__.py @@ -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', ], diff --git a/addons/note/note.py b/addons/note/note.py index 11b3af1ac89..88167fceeb1 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -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), diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml index 22ed73deca3..88b21effb7e 100644 --- a/addons/note/note_demo.xml +++ b/addons/note/note_demo.xml @@ -3,6 +3,7 @@ + Customer report #349872
* Calendar app in Home
* The base_calendar module should create a menu in Home, like described above. @@ -10,9 +11,7 @@
* We should use the term Calendar, not Meeting. ]]>
- - 2
@@ -21,27 +20,21 @@

* Followed by the telephone conversation and mail about D.544.3 ]]> - -
]]>
- -

]]>
- -
@@ -50,9 +43,7 @@
* wine ]]>
- - @@ -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 ]]> - - @@ -72,9 +61,7 @@
* Open ERP for Retail and Industrial Management ]]>
- - @@ -95,9 +82,7 @@ a big one, full of pixels, of course ! ]]> - - 3 @@ -107,9 +92,8 @@
* Open ERP for Retail and Industrial Management ]]>
- - + @@ -118,21 +102,7 @@
* Open ERP for Retail and Industrial Management ]]>
- - - - - -
* Open ERP: a modern approach to integrated business management -
* Open ERP for Retail and Industrial Management - ]]> -
- - - - 5
@@ -141,9 +111,7 @@
* Open ERP for Retail and Industrial Management ]]>
- - 7 @@ -153,9 +121,7 @@
* Open ERP for Retail and Industrial Management ]]>
- -
diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index 46c326279e8..872cae12c11 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -46,7 +46,7 @@ note.note.kanban note.note - + @@ -114,26 +114,28 @@ - + note.note.form note.note
- +
- + - + + +
- + note.note.search note.note @@ -146,8 +148,7 @@ - - +
@@ -186,9 +187,9 @@
- + - Memos + Sticky notes note.note form kanban,tree,form @@ -196,7 +197,7 @@ {'search_default_active_true':True} - + \ No newline at end of file diff --git a/addons/note/test/note_create.yml b/addons/note/test/note_create.yml new file mode 100644 index 00000000000..3b6f2fa3072 --- /dev/null +++ b/addons/note/test/note_create.yml @@ -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' \ No newline at end of file