Добавлена проверка на транзакции кошелька при удалении заказа

Удаление заказа теперь блокируется если есть связанные
WalletTransaction (on_delete=PROTECT).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 00:37:27 +03:00
parent 07829f867b
commit 1f8fd54c10
2 changed files with 10 additions and 1 deletions

View File

@@ -26,7 +26,7 @@
<a href="{% url 'orders:order-update' order.order_number %}" class="btn btn-primary">
<i class="bi bi-pencil"></i> Редактировать
</a>
{% if order.status and order.status.code == 'draft' and order.amount_paid == 0 %}
{% if order.status and order.status.code == 'draft' and order.amount_paid == 0 and not order.wallet_transactions.exists %}
<a href="{% url 'orders:order-delete' order.order_number %}" class="btn btn-danger">
<i class="bi bi-trash"></i> Удалить
</a>