Fix Product filtering and add kit disassembly functionality

Fixed:
- Replace is_active with status='active' for Product filtering in IncomingModelForm
- Product model uses status field instead of is_active

Added:
- Showcase field to ProductKit for tracking showcase placement
- product_kit field to Reservation for tracking kit-specific reservations
- Disassemble button in POS terminal for showcase kits
- API endpoint for kit disassembly (release reservations, mark discontinued)
- Improved reservation filtering when dismantling specific kits

Changes:
- ShowcaseManager now links reservations to specific kit instances
- POS terminal modal shows disassemble button in edit mode
- Kit disassembly properly updates stock aggregates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-20 23:03:47 +03:00
parent d3060176c0
commit ff0756498c
11 changed files with 221 additions and 14 deletions

View File

@@ -412,6 +412,10 @@ class Reservation(models.Model):
related_name='reservations', verbose_name="Витрина",
null=True, blank=True,
help_text="Витрина, на которой выложен букет")
product_kit = models.ForeignKey('products.ProductKit', on_delete=models.CASCADE,
related_name='reservations', verbose_name="Комплект",
null=True, blank=True,
help_text="Временный комплект, для которого создан резерв")
product = models.ForeignKey(Product, on_delete=models.CASCADE,
related_name='reservations', verbose_name="Товар")
warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE,
@@ -433,11 +437,14 @@ class Reservation(models.Model):
models.Index(fields=['status']),
models.Index(fields=['order_item']),
models.Index(fields=['showcase']),
models.Index(fields=['product_kit']),
]
def __str__(self):
if self.order_item:
context = f" (заказ {self.order_item.order.order_number})"
elif self.product_kit:
context = f" (комплект {self.product_kit.name})"
elif self.showcase:
context = f" (витрина {self.showcase.name})"
else: