Связал склад и спецификацию
All checks were successful
Auto-Deploy-prodman / deploy (push) Successful in 6s
All checks were successful
Auto-Deploy-prodman / deploy (push) Successful in 6s
This commit is contained in:
25
bom_manager/migrations/0008_item_material_item_weight.py
Normal file
25
bom_manager/migrations/0008_item_material_item_weight.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 6.0.2 on 2026-02-16 05:14
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bom_manager', '0007_alter_baseoperation_options'),
|
||||
('stock', '0002_gost_alter_basematerial_grade_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='item',
|
||||
name='material',
|
||||
field=models.ForeignKey(blank=True, help_text='Выберите тип заготовки для этой детали', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='items', to='stock.basematerial', verbose_name='Материал заготовки'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='item',
|
||||
name='weight',
|
||||
field=models.FloatField(blank=True, default=0, null=True, verbose_name='Вес'),
|
||||
),
|
||||
]
|
||||
@@ -3,6 +3,8 @@ from django.urls import reverse
|
||||
from mptt.models import MPTTModel, TreeForeignKey
|
||||
from polymorphic.models import PolymorphicModel
|
||||
from django.core.exceptions import ValidationError
|
||||
# импортируем модели из stock
|
||||
from stock.models import BaseMaterial
|
||||
# Create your models here.
|
||||
|
||||
# Базовая модель операции
|
||||
@@ -210,7 +212,18 @@ class Item(models.Model):
|
||||
# Технические данные
|
||||
drawing = models.FileField("Чертеж", upload_to='drawings/', blank=True, null=True)
|
||||
|
||||
# Связь с заготовкой
|
||||
material = models.ForeignKey(
|
||||
'stock.BaseMaterial',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="Материал заготовки",
|
||||
related_name="items",
|
||||
help_text="Выберите тип заготовки для этой детали"
|
||||
)
|
||||
|
||||
weight = models.FloatField("Вес", default=0, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Компонент"
|
||||
|
||||
Reference in New Issue
Block a user