fix contact for admin
This commit is contained in:
1 parent
f4fa16d9e7
commit
5fc9a908c5
2 files changed
+34
-1
No files matched your search
@@ -338,7 +338,15 @@ def staff_create(request):
|
||||
return render(request,"tickets/staff_create.html",{"form":form,"staff_unit":TicketPolicy.primary_unit(request.user),"active_tab_title":"ثبت تیکت برای مشتری"})
|
||||
|
||||
def _customer_rows(search="", user=None):
|
||||
qs=User.objects.filter(account_type=User.AccountType.CUSTOMER).select_related("customer_profile")
|
||||
# A CUSTOMER account can temporarily exist without its one-to-one profile
|
||||
# (legacy/imported or interrupted registrations). Such an account is not
|
||||
# an address-book contact and would make the contacts template dereference
|
||||
# a missing profile, especially for superusers whose scope includes all
|
||||
# customers.
|
||||
qs=User.objects.filter(
|
||||
account_type=User.AccountType.CUSTOMER,
|
||||
customer_profile__isnull=False,
|
||||
).select_related("customer_profile")
|
||||
has_unit_membership = user is not None and user.unit_memberships.filter(is_active=True, unit__is_active=True).exists()
|
||||
if user is not None and has_unit_membership and not (user.is_superuser or user.has_perm("tickets.view_all_tickets")):
|
||||
visible_customer_ids = staff_ticket_rows(user).values_list("customer_id", flat=True)
|
||||
|
||||
Reference in new issue
Block a user