diff options
| author | Divyesh Makwana (Open ERP) <mdi@tinyerp.com> | 2012-07-03 14:28:16 +0530 |
|---|---|---|
| committer | Divyesh Makwana (Open ERP) <mdi@tinyerp.com> | 2012-07-03 14:28:16 +0530 |
| commit | f28cfcfe8a16e77acd7e390e25fff2793e4e6548 (patch) | |
| tree | fe3fad1ad3f95ff11a34638ea5c7f325cecfa25c /addons/project/project.py | |
| parent | 9ce0d57fbe8357e00e72123e7e4c07326b26b261 (diff) | |
| parent | 1e123ce0c86060be9ad66fa8962912b14597c699 (diff) | |
[Merge] Merge with main addons.
bzr revid: mdi@tinyerp.com-20120703043709-c8o4k6hjfw5v8gn0
bzr revid: mdi@tinyerp.com-20120703085816-mc75d3ukecz03m79
Diffstat (limited to 'addons/project/project.py')
| -rw-r--r-- | addons/project/project.py | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/addons/project/project.py b/addons/project/project.py index 05a81c99514..487daa834bb 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -480,21 +480,14 @@ def Project(): # ------------------------------------------------ # OpenChatter methods and notifications # ------------------------------------------------ - - def get_needaction_user_ids(self, cr, uid, ids, context=None): - result = dict.fromkeys(ids) - for obj in self.browse(cr, uid, ids, context=context): - result[obj.id] = [] - if obj.state == 'draft' and obj.user_id: - result[obj.id] = [obj.user_id.id] - return result def message_get_subscribers(self, cr, uid, ids, context=None): - sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + """ Override to add responsible user. """ + user_ids = super(project, self).message_get_subscribers(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): - if obj.user_id: - sub_ids.append(obj.user_id.id) - return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + if obj.user_id and not obj.user_id.id in user_ids: + user_ids.append(obj.user_id.id) + return user_ids def create(self, cr, uid, vals, context=None): obj_id = super(project, self).create(cr, uid, vals, context=context) @@ -1145,20 +1138,26 @@ class task(base_stage, osv.osv): return 'Task' def get_needaction_user_ids(self, cr, uid, ids, context=None): - result = dict.fromkeys(ids, []) + """ Returns the user_ids that have to perform an action. + Add to the previous results given by super the document responsible + when in draft mode. + :return: dict { record_id: [user_ids], } + """ + result = super(task, self).get_needaction_user_ids(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): if obj.state == 'draft' and obj.user_id: - result[obj.id] = [obj.user_id.id] + result[obj.id].append(obj.user_id.id) return result def message_get_subscribers(self, cr, uid, ids, context=None): - sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + """ Override to add responsible user and project manager. """ + user_ids = super(task, self).message_get_subscribers(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): - if obj.user_id: - sub_ids.append(obj.user_id.id) - if obj.manager_id: - sub_ids.append(obj.manager_id.id) - return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + if obj.user_id and not obj.user_id.id in user_ids: + user_ids.append(obj.user_id.id) + if obj.manager_id and not obj.manager_id.id in user_ids: + user_ids.append(obj.manager_id.id) + return user_ids def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ |
