From 1f2f15c51df7018518dae72709faa493537223ab Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Mon, 17 Dec 2012 14:44:02 +0530 Subject: [PATCH] [IMP] update followers bzr revid: fka@tinyerp.com-20121217091402-pylrooffkzykcnu9 --- addons/analytic_contract_crm/analytic_contract_crm.py | 6 +++++- addons/crm/crm_lead.py | 5 ++--- addons/project/project.py | 5 +++++ addons/project_issue/project_issue.py | 8 ++++++-- addons/sale_crm/sale_crm.py | 3 +++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/addons/analytic_contract_crm/analytic_contract_crm.py b/addons/analytic_contract_crm/analytic_contract_crm.py index 07257dc9505..8dfdca08d41 100644 --- a/addons/analytic_contract_crm/analytic_contract_crm.py +++ b/addons/analytic_contract_crm/analytic_contract_crm.py @@ -39,10 +39,14 @@ class account_analytic_account(osv.osv): def write(self, cr, uid, ids, vals, context=None): if isinstance(ids, (int, long)): ids = [ids] + if vals.get('manager_id'): + section_id = self.pool.get('res.users').browse(cr, uid, vals.get('manager_id'), context=context).default_section_id + if section_id: + vals.setdefault('message_follower_ids', []) + vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in section_id.message_follower_ids] res = super(account_analytic_account, self).write(cr, uid, ids, vals, context=context) # subscribe new salesteam followers & subtypes to the contract if vals.get('manager_id'): - section_id = self.pool.get('res.users').browse(cr, uid, vals.get('manager_id'), context=context).default_section_id if section_id: self._subscribe_followers_subtype(cr, uid, ids, section_id, 'crm.case.section', context=context) return res diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index fbdc76f9ba6..d2357399713 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -915,9 +915,8 @@ class crm_lead(base_stage, format_address, osv.osv): vals['probability'] = stage.probability if vals.get('section_id'): section_id = self.pool.get('crm.case.section').browse(cr, uid, vals.get('section_id'), context=context) - if section_id: - vals.setdefault('message_follower_ids', []) - vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in section_id.message_follower_ids] + vals.setdefault('message_follower_ids', []) + vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in section_id.message_follower_ids] res = super(crm_lead,self).write(cr, uid, ids, vals, context) # subscribe new salesteam followers & subtypes to the lead if vals.get('section_id'): diff --git a/addons/project/project.py b/addons/project/project.py index f6ba1941ab3..39d4b5f17fc 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1122,6 +1122,11 @@ class task(base_stage, osv.osv): def write(self, cr, uid, ids, vals, context=None): if isinstance(ids, (int, long)): ids = [ids] + if vals.get('project_id'): + project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context) + if project_id: + vals.setdefault('message_follower_ids', []) + vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in project_id.message_follower_ids] if vals and not 'kanban_state' in vals and 'stage_id' in vals: new_stage = vals.get('stage_id') vals_reset_kstate = dict(vals, kanban_state='normal') diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 3255898999b..06948158b00 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -373,10 +373,14 @@ class project_issue(base_stage, osv.osv): vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S') # subscribe new project followers to the issue + if vals.get('project_id'): + project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context) + vals.setdefault('message_follower_ids', []) + vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in project_id.message_follower_ids] + res = super(project_issue, self).write(cr, uid, ids, vals, context) if vals.get('project_id'): self._subscribe_followers_subtype(cr, uid, ids, vals.get('project_id'), 'project.project', context=context) - - return super(project_issue, self).write(cr, uid, ids, vals, context) + return res def onchange_task_id(self, cr, uid, ids, task_id, context=None): if not task_id: diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index c1f50800d24..3ad6d602258 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -38,6 +38,9 @@ class sale_order(osv.osv): return order def write(self, cr, uid, ids, vals, context=None): + if vals.get('section_id'): + section_id = self.pool.get('crm.case.section').browse(cr, uid, vals.get('section_id'), context=context) + vals['message_follower_ids'] = [(6, 0, [follower.id]) for follower in section_id.message_follower_ids] res = super(sale_order, self).write(cr, uid, ids, vals, context=context) # subscribe new salesteam followers & subtypes to the sale order if vals.get('section_id'):