diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-05-22 10:30:12 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-05-22 10:30:12 +0200 |
| commit | 8aa85c2523a87db7555f1ca9dbda6e5cbc3306c9 (patch) | |
| tree | cac97d1957f928e077fe4d6fc06387e095831f1f /addons/note/note.py | |
| parent | d51cf606167f870bb6be260ef494fc96dea05b09 (diff) | |
| parent | 176481a97081644e40e3446d9db4ff685b043310 (diff) | |
[FORWARD] Forward port of addons until revision 8711
bzr revid: tde@openerp.com-20130521133807-5n97jep45f3lf6uq
bzr revid: tde@openerp.com-20130522083012-4yry4ht2943sjatn
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 |
