conventional-commit

feat(inventory): introduce stock deficit notifications and base quantity tracking

- Added `quantity_base` field to reservation model for precise inventory calculations
- Implemented non-blocking stock deficit warnings during kit creation process
- Enhanced API responses with warning details for frontend display
- Updated terminal interface to show formatted stock shortage alerts

BREAKING CHANGE: API response structure now includes `warnings` array instead of previous stock warning format
This commit is contained in:
2026-01-04 16:18:57 +03:00
parent a03f3df086
commit b7db4cd162
3 changed files with 24 additions and 5 deletions

View File

@@ -2065,10 +2065,10 @@ document.getElementById('confirmCreateTempKit').onclick = async () => {
Зарезервировано компонентов: ${data.reservations_count}`;
// Если есть предупреждение о нехватке товара - добавляем его
if (data.stock_warning && data.stock_warnings && data.stock_warnings.length > 0) {
if (data.warnings && data.warnings.length > 0) {
successMessage += '\n\n⚠ ВНИМАНИЕ: Нехватка товара на складе!\n';
data.stock_warnings.forEach(warning => {
successMessage += `\n${warning.product_name}: не хватает ${warning.overdraft} ед.`;
data.warnings.forEach(warning => {
successMessage += `\n${warning}`;
});
successMessage += '\n\nПроверьте остатки и пополните склад.';
}

View File

@@ -1096,7 +1096,8 @@ def create_temp_kit_to_showcase(request):
'kit_price': str(kit.actual_price),
'reservations_count': len(result['reservations']),
'showcase_item_ids': showcase_item_ids,
'available_count': created_count
'available_count': created_count,
'warnings': result.get('warnings')
})
except json.JSONDecodeError as e: