refactor: подготовка к стандартизации Transfer моделей

Текущее состояние перед рефакторингом Transfer → TransferDocument.
Все изменения с последнего коммита по улучшению системы поступлений.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 19:55:50 +03:00
parent 0da2995a74
commit c534e27c41
14 changed files with 198 additions and 313 deletions

View File

@@ -1,47 +1,13 @@
# -*- coding: utf-8 -*-
"""
Batch views - READ ONLY
- IncomingBatch (Партии поступлений)
- StockBatch (Партии товара на складе)
ПРИМЕЧАНИЕ: IncomingBatch и Incoming удалены. Используйте IncomingDocument вместо них.
"""
from django.views.generic import ListView, DetailView
from django.contrib.auth.mixins import LoginRequiredMixin
from ..models import IncomingBatch, Incoming, StockBatch, SaleBatchAllocation, WriteOff
class IncomingBatchListView(LoginRequiredMixin, ListView):
"""Список всех партий поступлений товара"""
model = IncomingBatch
template_name = 'inventory/incoming_batch/batch_list.html'
context_object_name = 'batches'
paginate_by = 30
def get_queryset(self):
return IncomingBatch.objects.all().select_related('warehouse').order_by('-created_at')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# Добавляем количество товаров в каждую партию
for batch in context['batches']:
batch.items_count = batch.items.count()
batch.total_quantity = sum(item.quantity for item in batch.items.all())
return context
class IncomingBatchDetailView(LoginRequiredMixin, DetailView):
"""Детальная информация по партии поступления"""
model = IncomingBatch
template_name = 'inventory/incoming_batch/batch_detail.html'
context_object_name = 'batch'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
batch = self.get_object()
# Товары в этой партии
context['items'] = batch.items.all().select_related('product', 'stock_batch')
return context
from ..models import StockBatch, SaleBatchAllocation, WriteOff
class StockBatchListView(LoginRequiredMixin, ListView):