From: Thibault Delavallée Date: Thu, 25 Oct 2012 15:26:01 +0000 (+0200) Subject: [REM] mail: removed trying to set a subtype when upgrading to mail. X-Git-Tag: 7.0-server~1048^2~97^2~8 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=cfebd61a520a450c7940ee04b4400eb40a0c7be5;p=odoo%2Fodoo.git [REM] mail: removed trying to set a subtype when upgrading to mail. bzr revid: tde@openerp.com-20121025152601-lksee1pkxnhtt63d --- diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py index d62a242..54b8a76 100644 --- a/addons/mail/res_users.py +++ b/addons/mail/res_users.py @@ -59,17 +59,15 @@ class res_users(osv.Model): # create aliases for all users and avoid constraint errors self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init, self._columns['alias_id'], 'login', alias_force_key='id', context=context) - # make already existing users follow themselves, using SQL to avoid using the ORM during the auto_init, and fetch the mail.mt_comment subtype - ref = self.pool.get('ir.model.data').get_object_reference(cr, SUPERUSER_ID, 'mail', 'mt_comment') - subtype_id = ref and ref[0] or False + # make already existing users follow themselves, using SQL to avoid using the ORM during the auto_init cr.execute(""" SELECT p.id FROM res_partner p LEFT JOIN mail_followers n ON (n.partner_id = p.id AND n.res_model = 'res.partner' AND n.res_id = p.id) WHERE n.id IS NULL """) - params = [(res[0], res[0], subtype_id) for res in cr.fetchall()] - cr.executemany(""" INSERT INTO mail_followers (partner_id, res_model, res_id, subtype_id) - VALUES (%s, 'res.partner', %s, %s) + params = [(res[0], res[0]) for res in cr.fetchall()] + cr.executemany(""" INSERT INTO mail_followers (partner_id, res_model, res_id) + VALUES (%s, 'res.partner', %s) """, params) def create(self, cr, uid, data, context=None):