Changement pour fix le select de recipeints
authorBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Wed, 6 Mar 2013 17:03:02 +0000 (12:03 -0500)
committerBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Wed, 6 Mar 2013 17:03:02 +0000 (12:03 -0500)
project/rh/admin.py

index 2de3ac1..44e5160 100644 (file)
@@ -1396,18 +1396,17 @@ def _communique(modaladmin, req, qs):
 
 
     for comb in combs:
-        # qf c'est pour trouver les recipients.
-        qf = reduce(
-            lambda x, y: x & y,
-            [Q(**{'changement_notifications__type': t}) for t in comb]
-            )
-        recipients = recipient_list.filter(qf)
+
+        recipients = ref.Employe.objects.none()
+        for t in comb:
+            recipients = recipient_list.filter(changement_notifications__type=t)
 
         recipient_list = recipient_list.exclude(
             id__in=recipients.values_list('id', flat=True))
 
         types_dict = dict(rh.TYPES_CHANGEMENT)
 
+        
         if len(recipients):
             ctx = {
                 'types': [
@@ -1425,7 +1424,6 @@ def _communique(modaladmin, req, qs):
                 for ch in qs.filter(type__in=[t]):
                     changements.append(ch)
                     
-
             template = loader.get_template('email/mouvement_employe.html')
             content = template.render(Context(ctx))