Исправлена ошибка создания заказов в POS после рефакторинга модели доставки

- Обновлён pos/views.py: метод pos_checkout теперь создаёт Order и связанную модель Delivery

- Обновлён showcase_manager.py: метод sell_showcase_item_to_customer использует новую архитектуру

- Удалён устаревший скрипт create_demo_orders.py

- Исправлена ошибка 'property is_delivery of Order object has no setter'
This commit is contained in:
2026-01-02 17:46:32 +03:00
parent 1ead77b2d8
commit 275bc1b78d
7 changed files with 528 additions and 227 deletions

View File

@@ -482,6 +482,91 @@
</div>
</div>
</div>
<!-- Модалка: Выбор единицы продажи товара -->
<div class="modal fade" id="selectProductUnitModal" tabindex="-1" aria-labelledby="selectProductUnitModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="selectProductUnitModalLabel">
<i class="bi bi-box-seam"></i> <span id="unitModalProductName"></span>
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<!-- Левая колонка: список единиц продажи -->
<div class="col-md-6">
<label class="form-label fw-semibold">Выберите единицу продажи</label>
<div id="unitSelectionList" class="d-flex flex-column gap-2" style="max-height: 400px; overflow-y: auto;">
<!-- Заполняется через JavaScript -->
</div>
</div>
<!-- Правая колонка: параметры -->
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<strong>Параметры добавления</strong>
</div>
<div class="card-body">
<!-- Выбранная единица -->
<div class="mb-3">
<label class="form-label small">Выбрана единица</label>
<div id="selectedUnitDisplay" class="fw-semibold text-primary"></div>
</div>
<!-- Количество -->
<div class="mb-3">
<label for="unitModalQuantity" class="form-label">Количество</label>
<div class="input-group">
<button class="btn btn-outline-secondary" type="button" id="unitQtyDecrement">
<i class="bi bi-dash"></i>
</button>
<input type="number" class="form-control text-center" id="unitModalQuantity"
value="1" min="0.001" step="1">
<button class="btn btn-outline-secondary" type="button" id="unitQtyIncrement">
<i class="bi bi-plus"></i>
</button>
</div>
<div id="unitQtyError" class="text-danger small mt-1" style="display: none;"></div>
<div id="unitQtyHint" class="text-muted small mt-1"></div>
</div>
<!-- Цена -->
<div class="mb-3">
<label for="unitModalPrice" class="form-label">Цена за единицу</label>
<div class="input-group">
<span class="input-group-text"></span>
<input type="number" class="form-control" id="unitModalPrice"
value="0" min="0" step="0.01">
</div>
<div id="priceOverrideIndicator" class="text-warning small mt-1" style="display: none;">
<i class="bi bi-exclamation-triangle"></i> Цена изменена
</div>
</div>
<!-- Итого -->
<div class="alert alert-info mb-0">
<div class="d-flex justify-content-between align-items-center">
<strong>Итого:</strong>
<span class="fs-4" id="unitModalSubtotal">0.00 ₽</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
<button type="button" class="btn btn-success" id="confirmAddUnitToCart" disabled>
<i class="bi bi-cart-plus"></i> Добавить в корзину
</button>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}