[MERGE] Merge partner changes
bzr revid: sbh@tinyerp.com-20120514121043-3n66ge2zsk1ieo7y
This commit is contained in:
@@ -9,3 +9,4 @@ Mail Module documentation topics
|
||||
mail_thread
|
||||
mail_openchatter_howto
|
||||
mail_needaction_howto
|
||||
mail_partner
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
What is shown
|
||||
==============
|
||||
- for every module which are related to partner show apporopriate message in the partner view like opportunities, sale orders and invoices.
|
||||
|
||||
|
||||
How it is done
|
||||
===============
|
||||
- _inherit = 'mail.thread'
|
||||
|
||||
- Override def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[], context=None) search by the partner
|
||||
@@ -24,11 +24,28 @@ from osv import fields
|
||||
|
||||
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 = {
|
||||
'emails': fields.one2many('mail.message', 'partner_id', 'Emails', readonly=True, domain=[('email_from','!=',False)]),
|
||||
}
|
||||
|
||||
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
|
||||
partner discussion page :
|
||||
- messages posted on res.partner, partner_id = partner.id
|
||||
- messages directly sent to partner
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
msg_obj = self.pool.get('mail.message')
|
||||
msg_ids = []
|
||||
for partner in self.browse(cr, uid, ids, context=context):
|
||||
msg_ids += msg_obj.search(cr, uid, ['|',('partner_id', '=', partner.id), '&', ('res_id', '=', partner.id), ('model', '=', self._name)] + 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()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
<xpath expr="/form/notebook/page[@string='History']" position="attributes">
|
||||
<attribute name="invisible">False</attribute>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook" position="after">
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_emails_partner_info_form" model="ir.ui.view">
|
||||
|
||||
Reference in New Issue
Block a user