Исправлено: отображение резервов и расчет quantity_reserved

- Проблема: debug_page показывал quantity вместо quantity_base для резервов

- Проблема: Stock.refresh_from_batches() суммировал quantity вместо quantity_base

- Решение:

  - debug_page.html: добавлены колонки для единиц продажи и базовых единиц

  - debug_page.html: теперь показывается quantity (ед.прод.) и quantity_base (базовые)

  - models.py: Stock.refresh_from_batches() теперь суммирует quantity_base

- Теперь quantity_reserved и quantity_free отображаются корректно в базовых единицах
This commit is contained in:
2026-01-02 14:40:53 +03:00
parent 25f2ba6b82
commit f34cfaeca0
2 changed files with 20 additions and 4 deletions

View File

@@ -739,7 +739,7 @@ class Stock(models.Model):
product=self.product,
warehouse=self.warehouse,
status='reserved'
).aggregate(models.Sum('quantity'))['quantity__sum'] or Decimal('0')
).aggregate(models.Sum('quantity_base'))['quantity_base__sum'] or Decimal('0')
self.quantity_available = total_qty
self.quantity_reserved = total_reserved