mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add database table for storing file attachments against a BuildOrder
This commit is contained in:
parent
8f108d42d2
commit
664dd0000c
31
InvenTree/build/migrations/0022_buildorderattachment.py
Normal file
31
InvenTree/build/migrations/0022_buildorderattachment.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 3.0.7 on 2020-10-26 04:17
|
||||
|
||||
import InvenTree.models
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('build', '0021_auto_20201020_0908_squashed_0026_auto_20201023_1228'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='BuildOrderAttachment',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('attachment', models.FileField(help_text='Select file to attach', upload_to=InvenTree.models.rename_attachment)),
|
||||
('comment', models.CharField(blank=True, help_text='File comment', max_length=100)),
|
||||
('upload_date', models.DateField(auto_now_add=True, null=True)),
|
||||
('build', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='build.Build')),
|
||||
('user', models.ForeignKey(blank=True, help_text='User', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
@ -5,6 +5,7 @@ Build database model definitions
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
@ -24,6 +25,7 @@ from mptt.models import MPTTModel, TreeForeignKey
|
||||
from InvenTree.status_codes import BuildStatus
|
||||
from InvenTree.helpers import increment, getSetting, normalize
|
||||
from InvenTree.validators import validate_build_order_reference
|
||||
from InvenTree.models import InvenTreeAttachment
|
||||
|
||||
import InvenTree.fields
|
||||
|
||||
@ -648,6 +650,17 @@ class Build(MPTTModel):
|
||||
return self.status == BuildStatus.COMPLETE
|
||||
|
||||
|
||||
class BuildOrderAttachment(InvenTreeAttachment):
|
||||
"""
|
||||
Model for storing file attachments against a BuildOrder object
|
||||
"""
|
||||
|
||||
def getSubdir(self):
|
||||
return os.path.join('bo_files', str(self.build.id))
|
||||
|
||||
build = models.ForeignKey(Build, on_delete=models.CASCADE, related_name='attachments')
|
||||
|
||||
|
||||
class BuildItem(models.Model):
|
||||
""" A BuildItem links multiple StockItem objects to a Build.
|
||||
These are used to allocate part stock to a build.
|
||||
|
@ -33,16 +33,16 @@ function getAvailableTableFilters(tableKey) {
|
||||
title: '{% trans "Is Serialized" %}',
|
||||
},
|
||||
serial_gte: {
|
||||
title: "{% trans "Serial number GTE" %}",
|
||||
description: "{% trans "Serial number greater than or equal to" %}"
|
||||
title: '{% trans "Serial number GTE" %}',
|
||||
description: '{% trans "Serial number greater than or equal to" %}'
|
||||
},
|
||||
serial_lte: {
|
||||
title: "{% trans "Serial number LTE" %}",
|
||||
description: "{% trans "Serial number less than or equal to" %}",
|
||||
title: '{% trans "Serial number LTE" %}',
|
||||
description: '{% trans "Serial number less than or equal to" %}',
|
||||
},
|
||||
serial: {
|
||||
title: "{% trans "Serial number" %}",
|
||||
description: "{% trans "Serial number" %}"
|
||||
title: '{% trans "Serial number" %}',
|
||||
description: '{% trans "Serial number" %}'
|
||||
},
|
||||
batch: {
|
||||
title: '{% trans "Batch" %}',
|
||||
@ -99,16 +99,16 @@ function getAvailableTableFilters(tableKey) {
|
||||
title: '{% trans "Is Serialized" %}',
|
||||
},
|
||||
serial: {
|
||||
title: "{% trans "Serial number" %}",
|
||||
description: "{% trans "Serial number" %}"
|
||||
title: '{% trans "Serial number" %}',
|
||||
description: '{% trans "Serial number" %}'
|
||||
},
|
||||
serial_gte: {
|
||||
title: "{% trans "Serial number GTE" %}",
|
||||
description: "{% trans "Serial number greater than or equal to" %}"
|
||||
title: '{% trans "Serial number GTE" %}',
|
||||
description: '{% trans "Serial number greater than or equal to" %}'
|
||||
},
|
||||
serial_lte: {
|
||||
title: "{% trans "Serial number LTE" %}",
|
||||
description: "{% trans "Serial number less than or equal to" %}",
|
||||
title: '{% trans "Serial number LTE" %}',
|
||||
description: '{% trans "Serial number less than or equal to" %}',
|
||||
},
|
||||
status: {
|
||||
options: stockCodes,
|
||||
@ -127,7 +127,7 @@ function getAvailableTableFilters(tableKey) {
|
||||
return {
|
||||
result: {
|
||||
type: 'bool',
|
||||
title: "{% trans 'Test result' %}",
|
||||
title: '{% trans "Test result" %}',
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -137,7 +137,7 @@ function getAvailableTableFilters(tableKey) {
|
||||
return {
|
||||
required: {
|
||||
type: 'bool',
|
||||
title: "{% trans "Required" %}",
|
||||
title: '{% trans "Required" %}',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user