From b37d6e72c168ec3446a6ced246c28325d46c2b9a Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 23 Jan 2014 11:34:25 +0100 Subject: [PATCH] [FIX] mail: adapt to improved behavior of ir_model_data.get_object() bzr revid: rco@openerp.com-20140123103425-gaud319o6t1f94qu --- addons/mail/mail_thread.py | 6 +++--- addons/mail/update.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 142d633c740..b8dbc580abf 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -165,7 +165,7 @@ class mail_thread(osv.AbstractModel): def read_followers_data(self, cr, uid, follower_ids, context=None): result = [] - technical_group = self.pool.get('ir.model.data').get_object(cr, uid, 'base', 'group_no_one', context=context, check_existence_and_raise=True) + technical_group = self.pool.get('ir.model.data').get_object(cr, uid, 'base', 'group_no_one', context=context) for follower in self.pool.get('res.partner').browse(cr, uid, follower_ids, context=context): is_editable = uid in map(lambda x: x.id, technical_group.users) is_uid = uid in map(lambda x: x.id, follower.user_ids) @@ -500,8 +500,8 @@ class mail_thread(osv.AbstractModel): posted = False for subtype in subtypes: - subtype_rec = self.pool.get('ir.model.data').get_object(cr, uid, subtype.split('.')[0], subtype.split('.')[1], context=context, check_existence_and_raise=False) - if not subtype_rec.exists(): + subtype_rec = self.pool.get('ir.model.data').get_object(cr, uid, subtype.split('.')[0], subtype.split('.')[1], context=context, check=False) + if not (subtype_rec and subtype_rec.exists()): _logger.debug('subtype %s not found' % subtype) continue message = format_message(subtype_rec.description if subtype_rec.description else subtype_rec.name, tracked_values) diff --git a/addons/mail/update.py b/addons/mail/update.py index 94286817648..f549f453b42 100644 --- a/addons/mail/update.py +++ b/addons/mail/update.py @@ -94,8 +94,8 @@ class publisher_warranty_contract(osv.osv): # old behavior based on res.log; now on mail.message, that is not necessarily installed IMD = self.pool['ir.model.data'] user = self.pool['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID) - poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees', context=context, check_existence_and_raise=False) - if not poster.exists(): + poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees', context=context, check=False) + if not (poster and poster.exists()): if not user.exists(): return True poster = user