mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
b0bdaab213
@ -54,12 +54,14 @@ INSTALLED_APPS = [
|
|||||||
'company.apps.CompanyConfig',
|
'company.apps.CompanyConfig',
|
||||||
'build.apps.BuildConfig',
|
'build.apps.BuildConfig',
|
||||||
|
|
||||||
|
# Third part add-ons
|
||||||
'django_filters',
|
'django_filters',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'simple_history',
|
'simple_history',
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
'import_export',
|
'import_export',
|
||||||
'django_cleanup',
|
'django_cleanup',
|
||||||
|
'qr_code',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -222,6 +222,7 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
'part',
|
'part',
|
||||||
|
'uuid',
|
||||||
'location',
|
'location',
|
||||||
'supplier_part',
|
'supplier_part',
|
||||||
'customer',
|
'customer',
|
||||||
|
@ -38,7 +38,7 @@ class CreateStockItemForm(HelperForm):
|
|||||||
|
|
||||||
class MoveStockItemForm(forms.ModelForm):
|
class MoveStockItemForm(forms.ModelForm):
|
||||||
|
|
||||||
note = forms.CharField(label='Notes', required=True)
|
note = forms.CharField(label='Notes', required=True, help_text='Add note (required)')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = StockItem
|
model = StockItem
|
||||||
|
19
InvenTree/stock/migrations/0006_stockitem_uuid.py
Normal file
19
InvenTree/stock/migrations/0006_stockitem_uuid.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 2.2 on 2019-04-12 15:06
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('stock', '0005_stockitemtracking_quantity'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stockitem',
|
||||||
|
name='uuid',
|
||||||
|
field=models.UUIDField(blank=True, default=uuid.uuid4, editable=False),
|
||||||
|
),
|
||||||
|
]
|
@ -11,6 +11,7 @@ from django.db.models.signals import pre_delete
|
|||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import uuid
|
||||||
|
|
||||||
from InvenTree.models import InvenTreeTree
|
from InvenTree.models import InvenTreeTree
|
||||||
|
|
||||||
@ -116,6 +117,9 @@ class StockItem(models.Model):
|
|||||||
('part', 'serial'),
|
('part', 'serial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# UUID for generating QR codes
|
||||||
|
uuid = models.UUIDField(default=uuid.uuid4, blank=True, editable=False)
|
||||||
|
|
||||||
# The 'master' copy of the part of which this stock item is an instance
|
# The 'master' copy of the part of which this stock item is an instance
|
||||||
part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='locations')
|
part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='locations')
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class StockItemSerializer(serializers.ModelSerializer):
|
|||||||
model = StockItem
|
model = StockItem
|
||||||
fields = [
|
fields = [
|
||||||
'pk',
|
'pk',
|
||||||
|
'uuid',
|
||||||
'url',
|
'url',
|
||||||
'part',
|
'part',
|
||||||
'supplier_part',
|
'supplier_part',
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
{% load qr_code %}
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-sm-6'>
|
<div class='col-sm-6'>
|
||||||
<h3>Stock Item Details</h3>
|
<h3>Stock Item Details</h3>
|
||||||
@ -29,11 +31,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% qr_from_text item.uuid size="s" image_format="png" error_correction="L" %}
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Part</td>
|
<td>Part</td>
|
||||||
<td><a href="{% url 'part-stock' item.part.id %}">{{ item.part.name }}</td>
|
<td><a href="{% url 'part-stock' item.part.id %}">{{ item.part.name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>UUID</td>
|
||||||
|
<td>{{ item.uuid }}</td>
|
||||||
|
</tr>
|
||||||
{% if item.belongs_to %}
|
{% if item.belongs_to %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Belongs To</td>
|
<td>Belongs To</td>
|
||||||
|
@ -8,3 +8,4 @@ pygments>=2.2.0
|
|||||||
django-crispy-forms>=1.7.2
|
django-crispy-forms>=1.7.2
|
||||||
django-import-export>=1.0.0
|
django-import-export>=1.0.0
|
||||||
django-cleanup>=2.1.0
|
django-cleanup>=2.1.0
|
||||||
|
django-qr-code==1.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user