Filter POS showcase kits by showcase__isnull=False
Fix issue where temporary kits created for orders (with order field set but showcase=NULL) were appearing in POS terminal showcase list. Problem: - When creating temporary kit from order edit page, it has order=<Order> and showcase=NULL - get_showcase_kits_for_pos() was showing ALL temporary kits with reserved components, regardless of showcase field - This caused order kits to appear in POS showcase view - Users couldn't add them to cart (showcase=NULL check failed) Solution: - Add showcase__isnull=False filter to ProductKit query - This ensures only kits explicitly assigned to showcases are shown - Order kits (showcase=NULL) are now excluded from POS showcase list Clear separation: - Temporary kits for orders: order != NULL, showcase = NULL - Temporary kits for showcases: showcase != NULL File: pos/views.py:85 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -77,9 +77,12 @@ def get_showcase_kits_for_pos():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Находим комплекты с резервированными компонентами
|
# Находим комплекты с резервированными компонентами
|
||||||
|
# ВАЖНО: фильтруем только комплекты, явно привязанные к витрине (showcase__isnull=False)
|
||||||
|
# Это исключает временные комплекты, созданные для заказов (order__isnull=False, showcase=NULL)
|
||||||
kits_with_showcase_items = ProductKit.objects.filter(
|
kits_with_showcase_items = ProductKit.objects.filter(
|
||||||
is_temporary=True,
|
is_temporary=True,
|
||||||
status='active',
|
status='active',
|
||||||
|
showcase__isnull=False, # Только витринные комплекты
|
||||||
kit_items__product_id__in=reserved_products
|
kit_items__product_id__in=reserved_products
|
||||||
).prefetch_related(
|
).prefetch_related(
|
||||||
first_photo_prefetch,
|
first_photo_prefetch,
|
||||||
|
|||||||
Reference in New Issue
Block a user