Добавлено свойство overpayment для корректного отображения переплаты
This commit is contained in:
@@ -372,6 +372,11 @@ class Order(models.Model):
|
|||||||
"""Остаток к оплате"""
|
"""Остаток к оплате"""
|
||||||
return max(self.total_amount - self.amount_paid, 0)
|
return max(self.total_amount - self.amount_paid, 0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def overpayment(self):
|
||||||
|
"""Переплата (если amount_paid > total_amount)"""
|
||||||
|
return max(self.amount_paid - self.total_amount, 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subtotal(self):
|
def subtotal(self):
|
||||||
"""Сумма только товаров (без доставки)"""
|
"""Сумма только товаров (без доставки)"""
|
||||||
|
|||||||
@@ -612,17 +612,15 @@
|
|||||||
|
|
||||||
<!-- Предупреждение о переплате -->
|
<!-- Предупреждение о переплате -->
|
||||||
{% if order.amount_paid > order.total_amount %}
|
{% if order.amount_paid > order.total_amount %}
|
||||||
{% with overpayment=order.amount_paid|add:"-"|add:order.total_amount %}
|
|
||||||
<div class="alert alert-warning mb-3">
|
<div class="alert alert-warning mb-3">
|
||||||
<i class="bi bi-exclamation-triangle-fill"></i> <strong>Обнаружена переплата!</strong><br>
|
<i class="bi bi-exclamation-triangle-fill"></i> <strong>Обнаружена переплата!</strong><br>
|
||||||
<small>
|
<small>
|
||||||
Оплачено <strong>{{ order.amount_paid|floatformat:2 }} руб.</strong>,
|
Оплачено <strong>{{ order.amount_paid|floatformat:2 }} руб.</strong>,
|
||||||
сумма заказа <strong>{{ order.total_amount|floatformat:2 }} руб.</strong><br>
|
сумма заказа <strong>{{ order.total_amount|floatformat:2 }} руб.</strong><br>
|
||||||
Переплата: <strong class="text-danger">{{ overpayment|floatformat:2 }} руб.</strong><br>
|
Переплата: <strong class="text-danger">{{ order.overpayment|floatformat:2 }} руб.</strong><br>
|
||||||
Создайте возврат в кошелёк клиента во вкладке «Создать возврат» ниже.
|
Создайте возврат в кошелёк клиента во вкладке «Создать возврат» ниже.
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user