[IMP]res_partner: override message_load_ids
bzr revid: kjo@tinyerp.com-20120423094452-bfj2nq5vsjtr5nk4
This commit is contained in:
@@ -23,7 +23,8 @@ from osv import fields,osv
|
||||
|
||||
class res_partner(osv.osv):
|
||||
""" Inherits partner and adds CRM information in the partner form """
|
||||
_inherit = 'res.partner'
|
||||
_name = "res.partner"
|
||||
_inherit = ['res.partner', 'mail.thread']
|
||||
_columns = {
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\
|
||||
@@ -68,6 +69,22 @@ class res_partner(osv.osv):
|
||||
}, context=context)
|
||||
opportunity_ids[partner_id] = opportunity_id
|
||||
return opportunity_ids
|
||||
|
||||
def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None):
|
||||
""" Override of message_load_ids
|
||||
User discussion page :
|
||||
- messages posted on res.partner, partner_id = user.id
|
||||
- messages directly sent to partner
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
msg_obj = self.pool.get('mail.message')
|
||||
msg_ids = []
|
||||
for user in self.browse(cr, uid, ids, context=context):
|
||||
msg_ids += msg_obj.search(cr, uid, [('partner_id', '=', user.id)] + domain,
|
||||
limit=limit, offset=offset, context=context)
|
||||
if (ascent): msg_ids = self._message_add_ancestor_ids(cr, uid, ids, msg_ids, root_ids, context=context)
|
||||
return msg_ids
|
||||
res_partner()
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<field name="section_id" completion="1" widget="selection"
|
||||
groups="base.group_extended"/>
|
||||
</field>
|
||||
<xpath expr="/form/notebook" position="after">
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user