diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 1ab4b3e..aa20da2 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 05fa632..84a3bab 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0006_fleetunit_contract_number_and_more.py b/core/migrations/0006_fleetunit_contract_number_and_more.py new file mode 100644 index 0000000..c9bd651 --- /dev/null +++ b/core/migrations/0006_fleetunit_contract_number_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 5.2.7 on 2026-01-27 20:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0005_supplier_fleetunit_insurance_policy_number_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='fleetunit', + name='contract_number', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Номер договора'), + ), + migrations.AlterField( + model_name='supplier', + name='contract_number', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Номер договора (общий)'), + ), + ] diff --git a/core/migrations/__pycache__/0006_fleetunit_contract_number_and_more.cpython-311.pyc b/core/migrations/__pycache__/0006_fleetunit_contract_number_and_more.cpython-311.pyc new file mode 100644 index 0000000..0e3e0fb Binary files /dev/null and b/core/migrations/__pycache__/0006_fleetunit_contract_number_and_more.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 6482c08..832c3f0 100644 --- a/core/models.py +++ b/core/models.py @@ -21,7 +21,7 @@ class Supplier(models.Model): representative_name = models.CharField(max_length=255, blank=True, null=True, verbose_name="ФИО представителя/менеджера") phone = models.CharField(max_length=50, blank=True, null=True, verbose_name="Телефон") email = models.EmailField(blank=True, null=True, verbose_name="Электронная почта") - contract_number = models.CharField(max_length=100, blank=True, null=True, verbose_name="Номер договора") + contract_number = models.CharField(max_length=100, blank=True, null=True, verbose_name="Номер договора (общий)") class Meta: verbose_name = "Поставщик / Контрагент" @@ -59,6 +59,7 @@ class FleetUnit(models.Model): # Supplier supplier = models.ForeignKey(Supplier, on_delete=models.SET_NULL, null=True, blank=True, verbose_name="Поставщик / Контрагент") + contract_number = models.CharField(max_length=100, blank=True, null=True, verbose_name="Номер договора") supplier_name = models.CharField(max_length=255, blank=True, null=True, verbose_name="Поставщик (старое)") supplier_contacts = models.TextField(blank=True, null=True, verbose_name="Контакты поставщика (старое)") vehicle_documents = models.FileField(upload_to="fleet_docs/", blank=True, null=True, verbose_name="Документы на авто") diff --git a/core/templates/core/fleet_detail.html b/core/templates/core/fleet_detail.html index 023dcd3..e5e831c 100644 --- a/core/templates/core/fleet_detail.html +++ b/core/templates/core/fleet_detail.html @@ -218,10 +218,14 @@
Данные по снабжению и поставщику
+
+

Номер договора (техника)

+

{{ unit.contract_number|default:"-" }}

+
+ {% if unit.supplier %}

Поставщик / Контрагент

{{ unit.supplier.name }}

-

Договор №{{ unit.supplier.contract_number|default:"-" }}

Представитель

{{ unit.supplier.representative_name|default:"-" }}

@@ -292,4 +296,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/core/templates/core/fleet_form.html b/core/templates/core/fleet_form.html index d82f33e..277f2d4 100644 --- a/core/templates/core/fleet_form.html +++ b/core/templates/core/fleet_form.html @@ -76,9 +76,19 @@
Снабжение
- + {{ form.supplier }} -
Выберите поставщика из списка. Создать нового можно в разделе "Снабжение".
+
Выберите поставщика из списка или создайте нового (откроется в новой вкладке).
+
+
+ + {{ form.contract_number }} +
Номер договора по данной единице техники.
@@ -109,4 +119,4 @@
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/views.py b/core/views.py index 7257a88..1bd9b94 100644 --- a/core/views.py +++ b/core/views.py @@ -26,7 +26,7 @@ class FleetUnitForm(forms.ModelForm): 'name', 'category', 'model_name', 'vin', 'plate_number', 'year', 'photo', 'status', 'commissioning_date', 'notes', 'insurance_company', 'insurance_policy_number', 'insurance_start_date', 'insurance_end_date', - 'supplier', 'vehicle_documents' + 'supplier', 'contract_number', 'vehicle_documents' ] widgets = { 'name': forms.TextInput(attrs={'class': 'form-control'}), @@ -44,6 +44,7 @@ class FleetUnitForm(forms.ModelForm): 'insurance_start_date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}), 'insurance_end_date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}), 'supplier': forms.Select(attrs={'class': 'form-select'}), + 'contract_number': forms.TextInput(attrs={'class': 'form-control'}), 'vehicle_documents': forms.FileInput(attrs={'class': 'form-control'}), } @@ -372,4 +373,4 @@ class SupplierUpdateView(UpdateView): class SupplierDeleteView(LoginRequiredMixin, StaffRequiredMixin, DeleteView): model = Supplier - success_url = reverse_lazy('supply_list') + success_url = reverse_lazy('supply_list') \ No newline at end of file