From c572cdcc2622b3553312aa29f36dbfa1034fe670 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Fri, 21 Nov 2025 00:32:49 +0300 Subject: [PATCH] Filter POS showcase kits by showcase__isnull=False MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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= 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 --- myproject/pos/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/myproject/pos/views.py b/myproject/pos/views.py index c8fb9f1..d52b73f 100644 --- a/myproject/pos/views.py +++ b/myproject/pos/views.py @@ -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( is_temporary=True, status='active', + showcase__isnull=False, # Волько Π²ΠΈΡ‚Ρ€ΠΈΠ½Π½Ρ‹Π΅ ΠΊΠΎΠΌΠΏΠ»Π΅ΠΊΡ‚Ρ‹ kit_items__product_id__in=reserved_products ).prefetch_related( first_photo_prefetch,