Конкретно пересмотрел логику работы. Легаси вынесена в архив
All checks were successful
Deploy MES Core / deploy (push) Successful in 13s
All checks were successful
Deploy MES Core / deploy (push) Successful in 13s
This commit is contained in:
@@ -20,8 +20,35 @@ from .models import (
|
||||
ProductionTask,
|
||||
ShiftItem,
|
||||
Workshop,
|
||||
WorkItem,
|
||||
DealEntityProgress,
|
||||
)
|
||||
|
||||
_models_to_reregister = (
|
||||
Company,
|
||||
CuttingSession,
|
||||
Deal,
|
||||
DealItem,
|
||||
DxfPreviewJob,
|
||||
DxfPreviewSettings,
|
||||
EmployeeProfile,
|
||||
Item,
|
||||
Machine,
|
||||
MaterialRequirement,
|
||||
ProductionReportConsumption,
|
||||
ProductionReportRemnant,
|
||||
ProductionTask,
|
||||
ShiftItem,
|
||||
Workshop,
|
||||
WorkItem,
|
||||
DealEntityProgress,
|
||||
)
|
||||
for _m in _models_to_reregister:
|
||||
try:
|
||||
admin.site.unregister(_m)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# --- Настройка отображения Компаний ---
|
||||
@admin.register(Company)
|
||||
class CompanyAdmin(admin.ModelAdmin):
|
||||
@@ -119,6 +146,21 @@ class ItemAdmin(admin.ModelAdmin):
|
||||
return obj.task.drawing_name if obj.task else "-"
|
||||
get_drawing.short_description = 'Деталь'
|
||||
|
||||
@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')
|
||||
search_fields = ('deal__number', 'entity__name', 'entity__drawing_number', 'operation__name', 'operation__code')
|
||||
autocomplete_fields = ('deal', 'entity', 'operation', 'workshop', 'machine')
|
||||
|
||||
|
||||
@admin.register(DealEntityProgress)
|
||||
class DealEntityProgressAdmin(admin.ModelAdmin):
|
||||
list_display = ('deal', 'entity', 'current_seq')
|
||||
search_fields = ('deal__number', 'entity__name', 'entity__drawing_number')
|
||||
autocomplete_fields = ('deal', 'entity')
|
||||
|
||||
|
||||
@admin.register(Workshop)
|
||||
class WorkshopAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'location')
|
||||
@@ -261,5 +303,5 @@ class DxfPreviewJobAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(EmployeeProfile)
|
||||
class EmployeeProfileAdmin(admin.ModelAdmin):
|
||||
list_display = ('user', 'role')
|
||||
filter_horizontal = ('machines',)
|
||||
list_display = ('user', 'role', 'is_readonly')
|
||||
filter_horizontal = ('machines', 'allowed_workshops')
|
||||
Reference in New Issue
Block a user