refactor: мигрировать на новую систему документов поступления
Удалена старая одноэтапная система incoming и оставлена только новая двухэтапная система IncomingDocument (черновик → проведение). Изменения: - URL структура изменена с /incoming-documents/ на /incoming/ - URL names: incoming-document-* → incoming-* - Удалены старые views, forms, templates для Incoming/IncomingBatch - Обновлена навигация и все ссылки в шаблонах - Модели IncomingBatch/Incoming сохранены как внутренняя архитектура Удалено ~1590 строк кода: - inventory/views/incoming.py (389 строк) - inventory/forms.py (206 строк старых форм) - inventory/admin.py (56 строк) - 4 шаблона incoming/*.html (895 строк) Обновлено: - inventory/urls.py - новая URL структура - inventory/views/incoming_document.py - обновлены redirects - Все шаблоны с ссылками на incoming 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,62 +93,6 @@ class StockBatchAdmin(admin.ModelAdmin):
|
||||
quantity_display.short_description = 'Количество'
|
||||
|
||||
|
||||
# ===== INCOMING BATCH =====
|
||||
@admin.register(IncomingBatch)
|
||||
class IncomingBatchAdmin(admin.ModelAdmin):
|
||||
list_display = ('document_number', 'warehouse', 'receipt_type_display', 'supplier_name', 'items_count', 'created_at')
|
||||
list_filter = ('warehouse', 'receipt_type', 'created_at')
|
||||
search_fields = ('document_number', 'supplier_name')
|
||||
date_hierarchy = 'created_at'
|
||||
fieldsets = (
|
||||
('Партия поступления', {
|
||||
'fields': ('document_number', 'warehouse', 'receipt_type', 'supplier_name', 'notes')
|
||||
}),
|
||||
('Даты', {
|
||||
'fields': ('created_at', 'updated_at'),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
)
|
||||
readonly_fields = ('created_at', 'updated_at')
|
||||
|
||||
def items_count(self, obj):
|
||||
return obj.items.count()
|
||||
items_count.short_description = 'Товаров'
|
||||
|
||||
def receipt_type_display(self, obj):
|
||||
colors = {
|
||||
'supplier': '#0d6efd', # primary (синий)
|
||||
'inventory': '#0dcaf0', # info (голубой)
|
||||
'adjustment': '#198754', # success (зеленый)
|
||||
}
|
||||
color = colors.get(obj.receipt_type, '#6c757d')
|
||||
return format_html(
|
||||
'<span style="color: {}; font-weight: bold;">{}</span>',
|
||||
color,
|
||||
obj.get_receipt_type_display()
|
||||
)
|
||||
receipt_type_display.short_description = 'Тип поступления'
|
||||
|
||||
|
||||
# ===== INCOMING =====
|
||||
@admin.register(Incoming)
|
||||
class IncomingAdmin(admin.ModelAdmin):
|
||||
list_display = ('product', 'batch', 'quantity', 'cost_price', 'created_at')
|
||||
list_filter = ('batch__warehouse', 'created_at', 'product')
|
||||
search_fields = ('product__name', 'batch__document_number')
|
||||
date_hierarchy = 'created_at'
|
||||
fieldsets = (
|
||||
('Товар в партии', {
|
||||
'fields': ('batch', 'product', 'quantity', 'cost_price', 'stock_batch')
|
||||
}),
|
||||
('Дата', {
|
||||
'fields': ('created_at',),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
)
|
||||
readonly_fields = ('created_at', 'stock_batch')
|
||||
|
||||
|
||||
# ===== SALE BATCH ALLOCATION (INLINE) =====
|
||||
class SaleBatchAllocationInline(admin.TabularInline):
|
||||
model = SaleBatchAllocation
|
||||
|
||||
Reference in New Issue
Block a user