mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 19:45:46 +00:00
Add 'project_code' field to Build model
This commit is contained in:
20
InvenTree/build/migrations/0043_build_project_code.py
Normal file
20
InvenTree/build/migrations/0043_build_project_code.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.2.19 on 2023-05-13 12:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('common', '0019_projectcode_metadata'),
|
||||||
|
('build', '0042_alter_build_notes'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='build',
|
||||||
|
name='project_code',
|
||||||
|
field=models.ForeignKey(blank=True, help_text='Project code for this build order', null=True, on_delete=django.db.models.deletion.SET_NULL, to='common.projectcode', verbose_name='Project Code'),
|
||||||
|
),
|
||||||
|
]
|
@ -61,6 +61,7 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
|
|||||||
issued_by: User that issued the build
|
issued_by: User that issued the build
|
||||||
responsible: User (or group) responsible for completing the build
|
responsible: User (or group) responsible for completing the build
|
||||||
priority: Priority of the build
|
priority: Priority of the build
|
||||||
|
project_code: Reference to ProjectCode instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -297,6 +298,14 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
|
|||||||
help_text=_('Priority of this build order')
|
help_text=_('Priority of this build order')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
project_code = models.ForeignKey(
|
||||||
|
'common.ProjectCode',
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
blank=True, null=True,
|
||||||
|
verbose_name=_('Project Code'),
|
||||||
|
help_text=_('Project code for this build order'),
|
||||||
|
)
|
||||||
|
|
||||||
def sub_builds(self, cascade=True):
|
def sub_builds(self, cascade=True):
|
||||||
"""Return all Build Order objects under this one."""
|
"""Return all Build Order objects under this one."""
|
||||||
if cascade:
|
if cascade:
|
||||||
|
Reference in New Issue
Block a user