self.message_subscribe(cr, uid, [user_id], [user_id], context=context)
return user_id
- #def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None):
- #if context is None:
- #context = {}
- #msg_obj = self.pool.get('mail.message')
- #msg_ids = msg_obj.search(cr, uid, ['&', ('res_id', 'in', ids), ('model', '=', self._name)] + domain,
- #limit=limit, offset=offset, context=context)
- #if (ascent): msg_ids = self._message_get_parent_ids(cr, uid, ids, msg_ids, root_ids, context=context)
- #return msg_ids
-
- #def message_load(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None):
- #msg_ids = self.message_load_ids(cr, uid, ids, limit, offset, domain, ascent, root_ids, context=context)
- #return self.pool.get('mail.message').read(cr, uid, msg_ids, context=context)
+ def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None):
+ if context is None:
+ context = {}
+ user_data = self.read(cr, uid, ids, ['id', 'login'], context=context)
+ msg_obj = self.pool.get('mail.message')
+ msg_ids = []
+ for x_id in range(0, len(ids)):
+ msg_ids += msg_obj.search(cr, uid, ['|', ('body_text', 'like', '@%s' % (user_data[x_id]['login'])), '&', ('res_id', '=', ids[x_id]), ('model', '=', self._name)] + domain,
+ limit=limit, offset=offset, context=context)
+ if (ascent): msg_ids = self._message_get_parent_ids(cr, uid, ids, msg_ids, root_ids, context=context)
+ return msg_ids