# -*- coding: utf-8 -*- """ SaleBatchAllocation (Распределение продаж по партиям) views - READ ONLY GROUP 3: LOW PRIORITY - Аудит и трассировка FIFO """ from django.views.generic import ListView from django.contrib.auth.mixins import LoginRequiredMixin from ..models import SaleBatchAllocation class SaleBatchAllocationListView(LoginRequiredMixin, ListView): """ Полный список всех распределений продаж по партиям. Используется для аудита и понимания как применялся FIFO. """ model = SaleBatchAllocation template_name = 'inventory/allocation/allocation_list.html' context_object_name = 'allocations' paginate_by = 30 def get_queryset(self): return SaleBatchAllocation.objects.select_related( 'sale', 'sale__product', 'batch', 'batch__product' ).order_by('-sale__date')