From 641b4875bffde4b2d594c8cecb056e884ce991db Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 2 Oct 2012 22:58:05 +0200 Subject: [PATCH 1/5] [FIX] bzr revid: fp@openerp.com-20121002205805-7v9am4avytue8gcg --- addons/base_status/base_stage.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/addons/base_status/base_stage.py b/addons/base_status/base_stage.py index f5c9d779896..617af125215 100644 --- a/addons/base_status/base_stage.py +++ b/addons/base_status/base_stage.py @@ -359,9 +359,6 @@ class base_stage(object): """ return '' - def find_subtype(self, cr, uid, ids, name, context=None): - return "mail.mt_comment" - def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Send a notification when the stage changes. This method has to be overriden, because each document will have its particular @@ -373,22 +370,19 @@ class base_stage(object): def case_open_send_note(self, cr, uid, ids, context=None): for id in ids: msg = _('%s has been opened.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) - xml_id = self.find_subtype(cr, uid, ids, context=context) - self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context) + self.message_post(cr, uid, [id], body=msg, context=context) return True def case_close_send_note(self, cr, uid, ids, context=None): for id in ids: msg = _('%s has been closed.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) - xml_id = self.find_subtype(cr, uid, ids, context=context) - self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context) + self.message_post(cr, uid, [id], body=msg, context=context) return True def case_cancel_send_note(self, cr, uid, ids, context=None): for id in ids: msg = _('%s has been cancelled.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) - xml_id = self.find_subtype(cr, uid, ids, context=context) - self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context) + self.message_post(cr, uid, [id], body=msg, context=context) return True def case_pending_send_note(self, cr, uid, ids, context=None): From 55ae1c8b4b5a2ea81e72dc8eac4575179d7348ad Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 2 Oct 2012 23:12:34 +0200 Subject: [PATCH 2/5] [FIX] bzr revid: fp@openerp.com-20121002211234-z6rlmxjwf762zvjb --- addons/hr/hr.py | 1 + addons/hr/hr_view.xml | 4 ++++ addons/project/project.py | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index aac1f41574f..eafe5d09844 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -90,6 +90,7 @@ class hr_job(osv.osv): _name = "hr.job" _description = "Job Description" + _inherit = ['mail.thread'] _columns = { 'name': fields.char('Job Name', size=128, required=True, select=True), 'expected_employees': fields.function(_no_of_employee, string='Total Employees', diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 6253205eb7e..69567902763 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -362,6 +362,10 @@ +
+ + +
diff --git a/addons/project/project.py b/addons/project/project.py index 09f026f9f13..6b02a018293 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1099,7 +1099,8 @@ class task(base_stage, osv.osv): task_record = self.browse(cr, uid, task_id, context=context) if task_record.project_id: project_follower_ids = [follower.id for follower in task_record.project_id.message_follower_ids] - self.message_subscribe(cr, uid, [task_id], project_follower_ids, context=context) + self.message_subscribe(cr, uid, [task_id], project_follower_ids, + context=context) self._store_history(cr, uid, [task_id], context=context) self.create_send_note(cr, uid, [task_id], context=context) return task_id From e275f37d1684da4cc89dd267bb96de1a20cb03d3 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 2 Oct 2012 23:43:02 +0200 Subject: [PATCH 3/5] [FIX] access rights bzr revid: fp@openerp.com-20121002214302-kk4ewbwadsme084w --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 943bc5f0164..0029dc7ca9f 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -719,7 +719,7 @@ class mail_thread(osv.AbstractModel): subtype_ids = subtype_obj.search(cr, uid, [('default', '=', True), '|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context) # update the subscriptions fol_obj = self.pool.get('mail.followers') - fol_ids = fol_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context) + fol_ids = fol_obj.search(cr, 1, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context) fol_obj.write(cr, uid, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) return True From 4dba044109b28e444207ed153b9cf99051b8c2ec Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 3 Oct 2012 00:12:31 +0200 Subject: [PATCH 4/5] [FIX] access rights bzr revid: fp@openerp.com-20121002221231-vtqfgu536tgs00n4 --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 0029dc7ca9f..788854891c9 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -706,7 +706,7 @@ class mail_thread(osv.AbstractModel): """ Wrapper on message_subscribe, using users. If user_ids is not provided, subscribe uid instead. """ if not user_ids: - user_ids = [uid] + return False partner_ids = [user.partner_id.id for user in self.pool.get('res.users').browse(cr, uid, user_ids, context=context)] return self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context) From 21fb8c43701057477c180375a2503d04ec6647e6 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 3 Oct 2012 00:18:04 +0200 Subject: [PATCH 5/5] [FIX] access rights bzr revid: fp@openerp.com-20121002221804-2mdhpkmyno2nfgvr --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 788854891c9..9f53b4c08b1 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -720,7 +720,7 @@ class mail_thread(osv.AbstractModel): # update the subscriptions fol_obj = self.pool.get('mail.followers') fol_ids = fol_obj.search(cr, 1, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context) - fol_obj.write(cr, uid, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) + fol_obj.write(cr, 1, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) return True def message_unsubscribe_users(self, cr, uid, ids, user_ids=None, context=None):