mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add new fields to Part model
- bom_checksum (stores checksum calculated when the BOM was checked) - bom_checked_by (User who checked the BOM) - bom_checked_date (When the BOM was last checked)
This commit is contained in:
parent
4c3032e2f0
commit
2431ba2a04
31
InvenTree/part/migrations/0022_auto_20190512_1246.py
Normal file
31
InvenTree/part/migrations/0022_auto_20190512_1246.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 2.2 on 2019-05-12 02:46
|
||||
|
||||
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),
|
||||
('part', '0021_auto_20190510_2220'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='bom_checked_by',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='boms_checked', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='bom_checked_date',
|
||||
field=models.DateField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='bom_checksum',
|
||||
field=models.CharField(blank=True, help_text='Stored BOM checksum', max_length=128),
|
||||
),
|
||||
]
|
@ -301,23 +301,23 @@ class Part(models.Model):
|
||||
|
||||
consumable = models.BooleanField(default=True, help_text='Can this part be used to build other parts?')
|
||||
|
||||
# Is this part "trackable"?
|
||||
# Trackable parts can have unique instances
|
||||
# which are assigned serial numbers (or batch numbers)
|
||||
# and can have their movements tracked
|
||||
trackable = models.BooleanField(default=False, help_text='Does this part have tracking for unique items?')
|
||||
|
||||
# Is this part "purchaseable"?
|
||||
purchaseable = models.BooleanField(default=True, help_text='Can this part be purchased from external suppliers?')
|
||||
|
||||
# Can this part be sold to customers?
|
||||
salable = models.BooleanField(default=False, help_text="Can this part be sold to customers?")
|
||||
|
||||
# Is this part active?
|
||||
active = models.BooleanField(default=True, help_text='Is this part active?')
|
||||
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
bom_checksum = models.CharField(max_length=128, blank=True, help_text='Stored BOM checksum')
|
||||
|
||||
bom_checked_by = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
related_name='boms_checked')
|
||||
|
||||
bom_checked_date = models.DateField(blank=True, null=True)
|
||||
|
||||
def format_barcode(self):
|
||||
""" Return a JSON string for formatting a barcode for this Part object """
|
||||
|
||||
@ -493,7 +493,7 @@ class Part(models.Model):
|
||||
for item in self.bom_items.all():
|
||||
hash.update(str(item.sub_part.full_name).encode())
|
||||
hash.update(str(item.quantity).encode())
|
||||
hash.update(str(item.notes).encode())
|
||||
hash.update(str(item.note).encode())
|
||||
|
||||
return str(hash.digest())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user