[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-auto_follow-atp-sales_auto_follow-pja

bzr revid: atp@tinyerp.com-20120924125139-uaw26laihpyk4u7o
This commit is contained in:
Atul Patel (OpenERP)
2012-09-24 18:21:39 +05:30
6 changed files with 25 additions and 16 deletions
+1
View File
@@ -102,6 +102,7 @@ class crm_case_section(osv.osv):
""" Model for sales teams. """
_name = "crm.case.section"
_inherits = {'mail.alias': 'alias_id'}
_inherit = "mail.thread"
_description = "Sales Teams"
_order = "complete_name"
+4
View File
@@ -277,6 +277,10 @@ class crm_lead(base_stage, format_address, osv.osv):
def create(self, cr, uid, vals, context=None):
obj_id = super(crm_lead, self).create(cr, uid, vals, context)
section_id = self.browse(cr, uid, obj_id, context=context).section_id
if section_id:
followers = [follow.id for follow in section_id.message_follower_ids]
self.message_subscribe(cr, uid, [obj_id], followers, context=context)
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
+4
View File
@@ -115,6 +115,10 @@
<field name="note"/>
</page>
</notebook>
<div class="oe_chatter">
<field name="message_ids" widget="mail_thread"/>
<field name="message_follower_ids" widget="mail_followers"/>
</div>
</form>
</field>
</record>
+4 -8
View File
@@ -1098,17 +1098,13 @@ class task(base_stage, osv.osv):
}, context=context)
return True
def project_message_followers(self, cr, uid, task_id, context=None):
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
project_obj = self.pool.get("project.project")
project_id = self.browse(cr, uid, task_id, context=context).project_id
if project_id:
followers = [follower.id for follower in project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids]
self.message_subscribe(cr, uid, task_id, followers, context=context)
return True
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
self.project_message_followers(cr, uid, task_id, context=context)
followers = [follower.id for follower in project_id.message_follower_ids]
self.message_subscribe(cr, uid, [task_id], followers, context=context)
self._store_history(cr, uid, [task_id], context=context)
self.create_send_note(cr, uid, [task_id], context=context)
return task_id
+4 -8
View File
@@ -379,16 +379,12 @@ class project_issue(base_stage, osv.osv):
self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
return res
def project_message_followers(self, cr, uid, issue_id, context=None):
project_obj = self.pool.get("project.project")
project_id = self.browse(cr, uid, issue_id, context=context).project_id
followers = [follower.id for follower in project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids]
self.message_subscribe(cr, uid, issue_id, followers, context=context)
return True
def create(self, cr, uid, vals, context=None):
obj_id = super(project_issue, self).create(cr, uid, vals, context=context)
self.project_message_followers(cr, uid, obj_id, context=context)
project_obj = self.pool.get("project.project")
project_id = self.browse(cr, uid, obj_id, context=context).project_id
followers = [follower.id for follower in project_id.message_follower_ids]
self.message_subscribe(cr, uid, [obj_id], followers, context=context)
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
+8
View File
@@ -30,6 +30,14 @@ class sale_order(osv.osv):
domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]")
}
def create(self, cr, uid, vals, context=None):
order = super(sale_order, self).create(cr, uid, vals, context=context)
section_id = self.browse(cr, uid, order, context=context).section_id
if section_id:
followers = [follow.id for follow in section_id.message_follower_ids]
self.message_subscribe(cr, uid, [order.id], followers, context=context)
return order
sale_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: