[FIX] mail_message: in check_access_rules, use self._table instead of hadcodded mail_...
authorThibault Delavallée <tde@openerp.com>
Mon, 17 Sep 2012 16:04:35 +0000 (18:04 +0200)
committerThibault Delavallée <tde@openerp.com>
Mon, 17 Sep 2012 16:04:35 +0000 (18:04 +0200)
bzr revid: tde@openerp.com-20120917160435-9ktdy4vpznvwr51s

addons/mail/mail_message.py

index d2bafca..9a9013c 100644 (file)
@@ -301,7 +301,7 @@ class mail_message(osv.Model):
         # Read mail_message.ids to have their values
         model_record_ids = {}
         message_values = dict.fromkeys(ids)
-        cr.execute('SELECT DISTINCT id, model, res_id, author_id FROM mail_message WHERE id = ANY (%s)', (ids,))
+        cr.execute('SELECT DISTINCT id, model, res_id, author_id FROM "%s" WHERE id = ANY (%%s)' % self._table, (ids,))
         for id, rmod, rid, author_id in cr.fetchall():
             message_values[id] = {'res_model': rmod, 'res_id': rid, 'author_id': author_id}
             if rmod: