diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-04-22 13:24:38 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-04-22 13:24:38 +0200 |
| commit | 0915663545d4ba29d8d2a6e2860b90a85a89fd0f (patch) | |
| tree | 97b9eb1d3f24a0bd7edada82de865a155f711fab /addons/note | |
| parent | 3d1e5d69988746871878df348e0ca9ab054f44a2 (diff) | |
[FIX] note: notes without user's stage are added to the first user's stage (sort by sequence)
bzr revid: chm@openerp.com-20130422112438-0f1s6we5ggq3t6xn
Diffstat (limited to 'addons/note')
| -rw-r--r-- | addons/note/note.py | 23 | ||||
| -rw-r--r-- | addons/note/note_data.xml | 6 |
2 files changed, 21 insertions, 8 deletions
diff --git a/addons/note/note.py b/addons/note/note.py index 2d95b15107a..90c2cb9bc54 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -141,12 +141,19 @@ class note_note(osv.osv): #note without user's stage nb_notes_ws = self.search(cr,uid, domain+[('stage_ids', 'not in', current_stage_ids)], context=context, count=True) if nb_notes_ws: - result += [{ #notes for unknown stage and if stage_ids is not empty - '__context': {'group_by': groupby[1:]}, - '__domain': domain + [('stage_ids', 'not in', current_stage_ids)], - 'stage_id': (0, 'Unknown'), - 'stage_id_count':nb_notes_ws - }] + # add note to the first column if it's the first stage + dom_not_in = ('stage_ids', 'not in', current_stage_ids) + if result and result[0]['stage_id'][0] == current_stage_ids[0]: + dom_in = result[0]['__domain'].pop() + result[0]['__domain'] = domain + ['|', dom_in, dom_not_in] + else: + # add the first stage column + result = [{ + '__context': {'group_by': groupby[1:]}, + '__domain': domain + [dom_not_in], + 'stage_id': (current_stage_ids[0], stage_name[current_stage_ids[0]]), + 'stage_id_count':nb_notes_ws + }] + result else: # if stage_ids is empty @@ -156,7 +163,7 @@ class note_note(osv.osv): result = [{ #notes for unknown stage '__context': {'group_by': groupby[1:]}, '__domain': domain, - 'stage_id': (0, 'Unknown'), + 'stage_id': False, 'stage_id_count':nb_notes_ws }] else: @@ -187,7 +194,7 @@ class res_users(osv.Model): model_id = data_obj.get_object_reference(cr, uid, 'base', 'group_user') #Employee Group group_id = model_id and model_id[1] or False if group_id in [x.id for x in user.groups_id]: - for note_xml_id in ['note_stage_01','note_stage_02','note_stage_03','note_stage_04']: + for note_xml_id in ['note_stage_00','note_stage_01','note_stage_02','note_stage_03','note_stage_04']: data_id = data_obj._get_id(cr, uid, 'note', note_xml_id) stage_id = data_obj.browse(cr, uid, data_id, context=context).res_id note_obj.copy(cr, uid, stage_id, default = { diff --git a/addons/note/note_data.xml b/addons/note/note_data.xml index 592292788b3..376b8e9053f 100644 --- a/addons/note/note_data.xml +++ b/addons/note/note_data.xml @@ -2,6 +2,12 @@ <openerp> <data> + <record model="note.stage" id="note_stage_00"> + <field name="name">New</field> + <field name="sequence" eval="0"/> + <field name="user_id" eval="ref('base.user_root')"/> + </record> + <record model="note.stage" id="note_stage_01"> <field name="name">Today</field> <field name="sequence">1</field> |
