it_manager: сортировка локаций по коду и полный список в селекте.
Аптеки А1…А70/П… вместо сортировки по адресу; убрать лимит 50 в searchable-select. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -88,10 +88,16 @@ def _it_locations_qs(user):
|
||||
queryset=Pharmacy.objects.select_related('organization'),
|
||||
),
|
||||
)
|
||||
.order_by('location_type', 'address')
|
||||
)
|
||||
|
||||
|
||||
def _it_locations_sorted(user) -> list:
|
||||
"""Офис/склад, затем аптеки по коду объекта (А1…А70, П1…), не по адресу."""
|
||||
from apps.locations.models.base import location_sort_key
|
||||
|
||||
return sorted(_it_locations_qs(user), key=location_sort_key)
|
||||
|
||||
|
||||
def _split_it_locations(locations):
|
||||
pharmacies, offices = [], []
|
||||
for loc in locations:
|
||||
@@ -301,7 +307,7 @@ def _it_manager_context(request):
|
||||
.annotate(units_total=models.Count('units', filter=Q(units__in=scoped_queryset(request.user, Equipment.objects.all()))))
|
||||
.order_by('equipment_type__name', 'brand__name', 'name')
|
||||
)
|
||||
locations_all = list(_it_locations_qs(request.user))
|
||||
locations_all = _it_locations_sorted(request.user)
|
||||
it_pharmacies, it_offices = _split_it_locations(locations_all)
|
||||
|
||||
tickets_qs = (
|
||||
|
||||
Reference in New Issue
Block a user