diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-05-22 13:42:36 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-05-22 13:42:36 +0200 |
| commit | cd278d83abd291209d7c3f18ee8eb9ab43a4158a (patch) | |
| tree | 8d866ce7e1d365667e0a4fe9e85b10f15d36ea3d /addons/note/note.py | |
| parent | c1cb8bf7653d98153c43e0ee35eb3558438e0b78 (diff) | |
| parent | d4d6e882668cfdc7c4634a0e30a047d0c83c75a7 (diff) | |
[MERGE] Sync with trunk
bzr revid: tde@openerp.com-20130522103305-yi5ql1chdx9qxxlx
bzr revid: tde@openerp.com-20130522114236-qi2s3i2dl2lemdvh
Diffstat (limited to 'addons/note/note.py')
| -rw-r--r-- | addons/note/note.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/addons/note/note.py b/addons/note/note.py index 2d95b15107a..eb9a6397d18 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,9 +194,12 @@ 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']: - data_id = data_obj._get_id(cr, uid, 'note', note_xml_id) + for note_xml_id in ['note_stage_00','note_stage_01','note_stage_02','note_stage_03','note_stage_04']: + try: + data_id = data_obj._get_id(cr, uid, 'note', note_xml_id) + except ValueError: + continue stage_id = data_obj.browse(cr, uid, data_id, context=context).res_id note_obj.copy(cr, uid, stage_id, default = { 'user_id': user_id}, context=context) - return user_id
\ No newline at end of file + return user_id |
