From 4707ee56a9e6f2d5b4af389a1adba8fd83f0dac4 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 6 Sep 2012 15:11:23 +0530 Subject: [PATCH] [IMP]add context to the method bzr revid: sgo@tinyerp.com-20120906094123-ua4zxhot0z3wgd7g --- addons/mail/mail_message.py | 2 +- addons/mail/mail_thread.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 3ef731b766b..be1fbe78176 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -335,7 +335,7 @@ class mail_message(osv.Model): missing_follow_ids = [] if message.subtype_id: for p_id in missing_notified: - follow_ids = followers_obj.search(cr, uid, [('partner_id','=',p_id),('subtype_ids','in',[message.subtype_id.id]),('res_model','=',message.model),('res_id','=',message.res_id)]) + follow_ids = followers_obj.search(cr, uid, [('partner_id','=',p_id),('subtype_ids','in',[message.subtype_id.id]),('res_model','=',message.model),('res_id','=',message.res_id)], context=context) if follow_ids and len(follow_ids): missing_follow_ids.append(p_id) message.write({'partner_ids': [(4, p_id) for p_id in missing_follow_ids]}) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 7fc6c79bd9a..4d627712742 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -600,9 +600,9 @@ class mail_thread(osv.AbstractModel): values = kwargs subtype_obj = self.pool.get('mail.message.subtype') if subtype: - subtypes = subtype_obj.name_search(cr, uid, subtype) + subtypes = subtype_obj.name_search(cr, uid, subtype,context=context) if len(subtypes): - subtype_browse = subtype_obj.browse(cr, uid, subtypes[0][0]) + subtype_browse = subtype_obj.browse(cr, uid, subtypes[0][0],context=context) if self._name in [model.model for model in subtype_browse.model_ids]: values['subtype_id']=subtype_browse.id values.update({ @@ -636,7 +636,7 @@ class mail_thread(osv.AbstractModel): self.write(cr, uid, ids, {'message_follower_ids': [(4, pid) for pid in partner_ids]}, context=context) if not subtype_ids: subtype_obj = self.pool.get('mail.message.subtype') - subtype_ids = subtype_obj.search(cr, uid, [('default', '=', 'true'),('model_ids.model', '=', self._name)]) + subtype_ids = subtype_obj.search(cr, uid, [('default', '=', 'true'),('model_ids.model', '=', self._name)],context=context) if subtype_ids: self.message_subscribe_udpate_subtypes(cr, uid, ids, partner_ids, subtype_ids, context=context) if context and context.get('read_back'): @@ -690,7 +690,7 @@ class mail_thread(osv.AbstractModel): def message_subscribe_udpate_subtypes(self, cr, uid, ids, user_id, subtype_ids,context=None): followers_obj = self.pool.get('mail.followers') - followers_ids = followers_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids)]) + followers_ids = followers_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids)], context=context) return followers_obj.write(cr, uid, followers_ids, {'subtype_ids': [(6, 0 , subtype_ids)]}, context = context) #overright or add new one # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: