From 92c70aa6ea76cbb58b216f4ba9d5b2f235b277e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 15 Aug 2012 22:51:43 +0200 Subject: [PATCH] [IMP] Addons: propagated new automatic subscription mechanism. bzr revid: tde@openerp.com-20120815205143-twthjirie2b5kr7n --- addons/crm/crm_lead.py | 8 ++++---- addons/hr_holidays/hr_holidays.py | 9 +++++---- addons/hr_recruitment/hr_recruitment.py | 8 ++++---- addons/mrp/mrp.py | 8 ++++---- addons/project/project.py | 14 +++++++------- addons/project_issue/project_issue.py | 8 ++++---- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 47cce7bc2d6..146417a7abb 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -859,10 +859,10 @@ class crm_lead(base_stage, osv.osv): # OpenChatter methods and notifications # ---------------------------------------- - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(crm_lead, self).message_get_follower_fields(cr, uid, ids, context=context) - return res.append('user_id') + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' to the monitored fields """ + res = super(crm_lead, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + return res + ['user_id'] def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 1788c857aba..45c65511a1a 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -366,10 +366,11 @@ class hr_holidays(osv.osv): result[obj.id] = hr_manager_group['users'] return result - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(hr_holidays, self).message_get_follower_fields(cr, uid, ids, context=context) - return res + ['user_id', 'employee_id.parent_id.user_id'] + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' and 'manager' to the monitored fields """ + res = super(hr_holidays, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + # TODO: add manager + return res + ['user_id'] def create_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index d62d78b049c..0ace2574d65 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -461,10 +461,10 @@ class hr_applicant(base_stage, osv.Model): # OpenChatter methods and notifications # ------------------------------------------------------- - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(hr_applicant, self).message_get_follower_fields(cr, uid, ids, context=context) - return res.append('user_id') + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' to the monitored fields """ + res = super(hr_applicant, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + return res + ['user_id'] def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index a41e4dbc332..7b8442b4c46 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1046,10 +1046,10 @@ class mrp_production(osv.osv): # OpenChatter methods and notifications # --------------------------------------------------- - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(mrp_production, self).message_get_follower_fields(cr, uid, ids, context=context) - return res.append('user_id') + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' to the monitored fields """ + res = super(mrp_production, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + return res + ['user_id'] def create_send_note(self, cr, uid, ids, context=None): self.message_append_note(cr, uid, ids, body=_("Manufacturing order has been created."), context=context) diff --git a/addons/project/project.py b/addons/project/project.py index ec216d245fc..1a8f8c8bfe5 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -514,10 +514,10 @@ def Project(): # OpenChatter methods and notifications # ------------------------------------------------ - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(project, self).message_get_follower_fields(cr, uid, ids, context=context) - return res.append('user_id') + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' to the monitored fields """ + res = super(project, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + return res + ['user_id'] def create(self, cr, uid, vals, context=None): if context is None: context = {} @@ -1201,9 +1201,9 @@ class task(base_stage, osv.osv): result[obj.id].append(obj.user_id.id) return result - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(task, self).message_get_follower_fields(cr, uid, ids, context=context) + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' and 'manager_id' to the monitored fields """ + res = super(task, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) return res + ['user_id', 'manager_id'] def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 81550f476b6..5c440976b5c 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -499,10 +499,10 @@ class project_issue(base_stage, osv.osv): # OpenChatter methods and notifications # ------------------------------------------------------- - def message_get_follower_fields(self, cr, uid, ids, context=None): - """ Override to add 'user_id' field to automatic subscription. """ - res = super(project_issue, self).message_get_follower_fields(cr, uid, ids, context=context) - return res.append('user_id') + def message_get_monitored_follower_fields(self, cr, uid, ids, context=None): + """ Add 'user_id' to the monitored fields """ + res = super(project_issue, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) + return res + ['user_id'] def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """