From da8ef32769fd6c956934fa46ab9d1a782db6301e Mon Sep 17 00:00:00 2001 From: ackFromRedmi Date: Wed, 22 Apr 2026 08:41:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B2=D0=B5=D0=BB=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D0=BA=D1=83=20=D1=81=D0=B4=D0=B5=D0=BB=D0=BE=D0=BA=20?= =?UTF-8?q?=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BF=D0=B0=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shiftflow/admin.py | 10 +++++----- shiftflow/views.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/shiftflow/admin.py b/shiftflow/admin.py index a82a129..20f917b 100644 --- a/shiftflow/admin.py +++ b/shiftflow/admin.py @@ -148,17 +148,17 @@ class ItemAdmin(admin.ModelAdmin): @admin.register(WorkItem) class WorkItemAdmin(admin.ModelAdmin): - list_display = ('date', 'deal', 'entity', 'operation', 'workshop', 'machine', 'quantity_plan', 'quantity_done', 'status') - list_filter = ('date', 'status', 'workshop', 'machine', 'operation') + list_display = ('date', 'deal', 'delivery_batch', 'entity', 'operation', 'workshop', 'machine', 'quantity_plan', 'quantity_done', 'status') + list_filter = ('date', 'status', 'workshop', 'machine', 'operation', 'delivery_batch') search_fields = ('deal__number', 'entity__name', 'entity__drawing_number', 'operation__name', 'operation__code') - autocomplete_fields = ('deal', 'entity', 'operation', 'workshop', 'machine') + autocomplete_fields = ('deal', 'delivery_batch', 'entity', 'operation', 'workshop', 'machine') @admin.register(DealEntityProgress) class DealEntityProgressAdmin(admin.ModelAdmin): - list_display = ('deal', 'entity', 'current_seq') + list_display = ('deal', 'delivery_batch', 'entity', 'current_seq') search_fields = ('deal__number', 'entity__name', 'entity__drawing_number') - autocomplete_fields = ('deal', 'entity') + autocomplete_fields = ('deal', 'delivery_batch', 'entity') @admin.register(Workshop) diff --git a/shiftflow/views.py b/shiftflow/views.py index 02c72e3..4fc5b1a 100644 --- a/shiftflow/views.py +++ b/shiftflow/views.py @@ -641,7 +641,11 @@ class WeldingPlanAddView(LoginRequiredMixin, View): return redirect(next_url if next_url.startswith('/') else 'planning') # Комментарий: берём текущую операцию по маршруту детали/сборки. - cur = DealEntityProgress.objects.filter(deal_id=deal_id, entity_id=entity_id).values_list('current_seq', flat=True).first() + cur = ( + DealEntityProgress.objects.filter(deal_id=deal_id, delivery_batch_id__isnull=True, entity_id=entity_id) + .values_list('current_seq', flat=True) + .first() + ) cur = int(cur or 1) eo = EntityOperation.objects.select_related('operation').filter(entity_id=entity_id, seq=cur).first() op = eo.operation if eo else Operation.objects.filter(code='welding').first() @@ -737,7 +741,11 @@ class PaintingPlanAddView(LoginRequiredMixin, View): # Комментарий: покраску можно планировать только на то, что реально сварено. # Доступно к покраске = min(заказано, сварено) − уже в плане покраски. # Комментарий: берём текущую операцию по маршруту детали/сборки. - cur = DealEntityProgress.objects.filter(deal_id=deal_id, entity_id=entity_id).values_list('current_seq', flat=True).first() + cur = ( + DealEntityProgress.objects.filter(deal_id=deal_id, delivery_batch_id__isnull=True, entity_id=entity_id) + .values_list('current_seq', flat=True) + .first() + ) cur = int(cur or 1) eo = EntityOperation.objects.select_related('operation').filter(entity_id=entity_id, seq=cur).first() op = eo.operation if eo else Operation.objects.filter(code='painting').first()