diff options
| author | Jiten (OpenERP) <jra@tinyerp.com> | 2012-06-27 13:25:08 +0530 |
|---|---|---|
| committer | Jiten (OpenERP) <jra@tinyerp.com> | 2012-06-27 13:25:08 +0530 |
| commit | 18dd2dfcab7ee866f5e344ea5c26d4e78faba2f2 (patch) | |
| tree | 068dcc026be4048b1bf56df1c6a61a28dcf34b0c /addons/mail/mail_thread.py | |
| parent | ea46eb264517fac17720f3a9a524c766e891ac1d (diff) | |
| parent | 6c0bdc167b1c6a5b2cbb36a045bfd1abc1cd121a (diff) | |
[MERGE] Merged from openobject-addons.
bzr revid: jra@tinyerp.com-20120627075508-kko9c9dr67695hzw
Diffstat (limited to 'addons/mail/mail_thread.py')
| -rw-r--r-- | addons/mail/mail_thread.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 0f404155f42..e0f2bfaf455 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -68,9 +68,14 @@ class mail_thread(osv.osv): res[id] = self.message_load_ids(cr, uid, [id], context=context) return res + def _search_message_ids(self, cr, uid, obj, name, args, context=None): + msg_obj = self.pool.get('mail.message') + msg_ids = msg_obj.search(cr, uid, ['&', ('res_id', 'in', args[0][2]), ('model', '=', self._name)], context=context) + return [('id', 'in', msg_ids)] + # OpenChatter: message_ids is a dummy field that should not be used _columns = { - 'message_ids': fields.function(_get_message_ids, method=True, + 'message_ids': fields.function(_get_message_ids, method=True, fnct_search=_search_message_ids, type='one2many', obj='mail.message', string='Temp messages', _fields_id = 'res_id'), } @@ -294,7 +299,7 @@ class mail_thread(osv.osv): } to_attach.append(ir_attachment.create(cr, uid, data_attach, context=context)) - partner_id = hasattr(thread, 'partner_id') and (thread.partner_id and thread.partner_id.id or False) or False + partner_id = ('partner_id' in thread._columns.keys()) and (thread.partner_id and thread.partner_id.id or False) or False if not partner_id and thread._name == 'res.partner': partner_id = thread.id data = { |
