Улучшены карточки товаров в POS: добавлены фото, артикул, цена и статус наличия
This commit is contained in:
@@ -12,14 +12,18 @@ def pos_terminal(request):
|
||||
Shows categories and in-stock products for quick tap-to-add.
|
||||
"""
|
||||
categories_qs = ProductCategory.objects.filter(is_active=True)
|
||||
products_qs = Product.objects.filter(in_stock=True).prefetch_related('categories')
|
||||
# Показываем все товары, не только in_stock
|
||||
products_qs = Product.objects.all().prefetch_related('categories', 'photos')
|
||||
|
||||
categories = [{'id': c.id, 'name': c.name} for c in categories_qs]
|
||||
products = [{
|
||||
'id': p.id,
|
||||
'name': p.name,
|
||||
'price': str(p.actual_price),
|
||||
'category_ids': [c.id for c in p.categories.all()]
|
||||
'category_ids': [c.id for c in p.categories.all()],
|
||||
'in_stock': p.in_stock,
|
||||
'sku': p.sku or '',
|
||||
'image': p.photos.first().get_thumbnail_url() if p.photos.exists() else None
|
||||
} for p in products_qs]
|
||||
|
||||
context = {
|
||||
|
||||
Reference in New Issue
Block a user