[FIX] mail: adapt to improved behavior of ir_model_data.get_object()
authorRaphael Collet <rco@openerp.com>
Thu, 23 Jan 2014 10:34:25 +0000 (11:34 +0100)
committerRaphael Collet <rco@openerp.com>
Thu, 23 Jan 2014 10:34:25 +0000 (11:34 +0100)
bzr revid: rco@openerp.com-20140123103425-gaud319o6t1f94qu

addons/mail/mail_thread.py
addons/mail/update.py

index 142d633..b8dbc58 100644 (file)
@@ -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)
index 9428681..f549f45 100644 (file)
@@ -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