8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-09 03:16:25 +00:00

Non member can't buy connexion : They need to pay membership

This commit is contained in:
Maxime Bombar 2018-11-01 01:07:33 +01:00 committed by detraz
parent b3dc063c20
commit baa2369436

View file

@ -624,6 +624,10 @@ class Article(RevMixin, AclMixin, models.Model):
objects_pool = cls.objects.filter( objects_pool = cls.objects.filter(
Q(type_user='All') | Q(type_user='Adherent') Q(type_user='All') | Q(type_user='Adherent')
) )
if not target_user.is_adherent():
objects_pool = objects_pool.filter(
Q(type_cotisation='All') | Q(type_cotisation='Adhesion')
)
if user.has_perm('cotisations.buy_every_article'): if user.has_perm('cotisations.buy_every_article'):
return objects_pool return objects_pool
return objects_pool.filter(available_for_everyone=True) return objects_pool.filter(available_for_everyone=True)
@ -874,4 +878,3 @@ def cotisation_post_delete(**_kwargs):
""" """
regen('mac_ip_list') regen('mac_ip_list')
regen('mailing') regen('mailing')