[IMP] hr_holidays: deleted automatic subscription creation, now delegated to mail...
authorThibault Delavallée <tde@openerp.com>
Tue, 28 Feb 2012 14:07:30 +0000 (15:07 +0100)
committerThibault Delavallée <tde@openerp.com>
Tue, 28 Feb 2012 14:07:30 +0000 (15:07 +0100)
bzr revid: tde@openerp.com-20120228140730-xke7ys2j2vcx3ruo

addons/hr_holidays/hr_holidays.py

index 78db0dc..f63dcf9 100644 (file)
@@ -358,12 +358,16 @@ class hr_holidays(osv.osv):
     # OpenChatter and notifications
     # -----------------------------
     
-    def create_notificate(self, cr, uid, ids, context=None):
+    def message_get_subscribers(self, cr, uid, ids, context=None):
+        sub_ids = self._message_get_subscribers_ids(cr, uid, ids, context=context);
+        # add the employee and its manager if specified to the subscribed users
         for obj in self.browse(cr, uid, ids, context=context):
-            # add the employee and its manager if specified to the subscribed users
-            self.message_subscribe(cr, uid, ids, [obj.employee_id.user_id.id], context=context)
             if obj.employee_id.parent_id:
-                self.message_subscribe(cr, uid, ids, [obj.employee_id.parent_id.user_id.id], context=context)
+                sub_ids.append(obj.employee_id.parent_id.user_id.id)
+        return self.pool.get('res.users').read(cr, uid, sub_ids, context=context)
+        
+    def create_notificate(self, cr, uid, ids, context=None):
+        for obj in self.browse(cr, uid, ids, context=context):
             self.message_append_note(cr, uid, ids, _('System notification'),
                         _("The %s request '%s' has been created and is waiting confirmation")
                         % ('leave' if obj.type == 'remove' else 'allocation', obj.name), type='notification', context=context)