fix: Улучшения системы ценообразования комплектов

Исправлены 4 проблемы:
1. Расчёт цены первого товара - улучшена валидация в getProductPrice и calculateFinalPrice
2. Отображение actual_price в Select2 вместо обычной цены
3. Количество по умолчанию = 1 для новых форм компонентов
4. Auto-select текста при клике на поле количества для удобства редактирования

Изменённые файлы:
- products/forms.py: добавлен __init__ в KitItemForm для quantity.initial = 1
- products/templates/includes/select2-product-init.html: обновлена formatSelectResult
- products/templates/productkit_create.html: добавлен focus handler для auto-select
- products/templates/productkit_edit.html: добавлен focus handler для auto-select

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-02 19:04:03 +03:00
parent c84a372f98
commit 6c8af5ab2c
120 changed files with 9035 additions and 3036 deletions

View File

@@ -1,4 +1,5 @@
{% extends 'inventory/base_inventory.html' %}
{% load inventory_filters %}
{% block inventory_title %}Массовое поступление товара{% endblock %}
{% block inventory_content %}

View File

@@ -1,4 +1,5 @@
{% extends 'inventory/base_inventory.html' %}
{% load inventory_filters %}
{% block inventory_title %}Отмена приходу товара{% endblock %}
@@ -23,8 +24,8 @@
<ul class="mb-0">
<li><strong>Товар:</strong> {{ incoming.product.name }}</li>
<li><strong>Склад:</strong> {{ incoming.warehouse.name }}</li>
<li><strong>Количество:</strong> {{ incoming.quantity }} шт</li>
<li><strong>Цена закупки:</strong> {{ incoming.cost_price }} </li>
<li><strong>Количество:</strong> {{ incoming.quantity|smart_quantity }} шт</li>
<li><strong>Цена закупки:</strong> {{ incoming.cost_price }} руб.</li>
{% if incoming.document_number %}
<li><strong>Номер документа:</strong> {{ incoming.document_number }}</li>
{% endif %}

View File

@@ -1,4 +1,5 @@
{% extends 'inventory/base_inventory.html' %}
{% load inventory_filters %}
{% block inventory_title %}
{% if form.instance.pk %}
@@ -55,7 +56,7 @@
<label for="{{ form.quantity.id_for_label }}" class="form-label">
{{ form.quantity.label }} <span class="text-danger">*</span>
</label>
{{ form.quantity }}
{{ form.quantity|smart_quantity }}
{% if form.quantity.errors %}
<div class="invalid-feedback d-block">
{% for error in form.quantity.errors %}{{ error }}{% endfor %}

View File

@@ -1,4 +1,5 @@
{% extends 'inventory/base_inventory.html' %}
{% load inventory_filters %}
{% block inventory_title %}История приходов товара{% endblock %}
@@ -32,8 +33,8 @@
<tr>
<td><strong>{{ incoming.product.name }}</strong></td>
<td>{{ incoming.batch.warehouse.name }}</td>
<td>{{ incoming.quantity }} шт</td>
<td>{{ incoming.cost_price }} </td>
<td>{{ incoming.quantity|smart_quantity }} шт</td>
<td>{{ incoming.cost_price }} руб.</td>
<td>
{% if incoming.batch.document_number %}
<code>{{ incoming.batch.document_number }}</code>