Rename "URL" to "link" for StockItem and StockItemTracking models

This commit is contained in:
Oliver Walters 2020-04-06 10:43:06 +10:00
parent 2530313e68
commit bd407cd226
8 changed files with 80 additions and 21 deletions

View File

@ -378,8 +378,8 @@ function loadStockTrackingTable(table, options) {
html += "<br><i>" + row.notes + "</i>"; html += "<br><i>" + row.notes + "</i>";
} }
if (row.URL) { if (row.link) {
html += "<br><a href='" + row.URL + "'>" + row.URL + "</a>"; html += "<br><a href='" + row.link + "'>" + row.link + "</a>";
} }
return html; return html;

View File

@ -329,6 +329,7 @@ class StockList(generics.ListCreateAPIView):
'batch', 'batch',
'status', 'status',
'notes', 'notes',
'link',
'location', 'location',
'location__name', 'location__name',
'location__description', 'location__description',

View File

@ -42,9 +42,9 @@ class CreateStockItemForm(HelperForm):
'quantity', 'quantity',
'batch', 'batch',
'serial_numbers', 'serial_numbers',
'link',
'delete_on_deplete', 'delete_on_deplete',
'status', 'status',
'URL',
] ]
# Custom clean to prevent complex StockItem.clean() logic from running (yet) # Custom clean to prevent complex StockItem.clean() logic from running (yet)
@ -161,7 +161,7 @@ class EditStockItemForm(HelperForm):
'serial', 'serial',
'batch', 'batch',
'status', 'status',
'URL', 'link',
'delete_on_deplete', 'delete_on_deplete',
] ]
@ -176,5 +176,5 @@ class TrackingEntryForm(HelperForm):
fields = [ fields = [
'title', 'title',
'notes', 'notes',
'URL', 'link',
] ]

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.10 on 2020-04-05 22:39
import InvenTree.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stock', '0023_auto_20200318_1027'),
]
operations = [
migrations.AlterField(
model_name='stockitem',
name='URL',
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external URL', max_length=125),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2.10 on 2020-04-05 22:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stock', '0024_auto_20200405_2239'),
]
operations = [
migrations.RenameField(
model_name='stockitem',
old_name='URL',
new_name='link',
),
migrations.RenameField(
model_name='stockitemtracking',
old_name='URL',
new_name='link',
),
]

View File

@ -114,7 +114,7 @@ class StockItem(MPTTModel):
quantity: Number of stocked units quantity: Number of stocked units
batch: Batch number for this StockItem batch: Batch number for this StockItem
serial: Unique serial number for this StockItem serial: Unique serial number for this StockItem
URL: Optional URL to link to external resource link: Optional URL to link to external resource
updated: Date that this stock item was last updated (auto) updated: Date that this stock item was last updated (auto)
stocktake_date: Date of last stocktake for this item stocktake_date: Date of last stocktake for this item
stocktake_user: User that performed the most recent stocktake stocktake_user: User that performed the most recent stocktake
@ -328,7 +328,7 @@ class StockItem(MPTTModel):
serial = models.PositiveIntegerField(blank=True, null=True, serial = models.PositiveIntegerField(blank=True, null=True,
help_text=_('Serial number for this item')) help_text=_('Serial number for this item'))
URL = InvenTreeURLField(max_length=125, blank=True) link = InvenTreeURLField(max_length=125, blank=True, help_text=_("Link to external URL"))
batch = models.CharField(max_length=100, blank=True, null=True, batch = models.CharField(max_length=100, blank=True, null=True,
help_text=_('Batch code for this stock item')) help_text=_('Batch code for this stock item'))
@ -793,7 +793,7 @@ class StockItemTracking(models.Model):
date: Date that this tracking info was created date: Date that this tracking info was created
title: Title of this tracking info (generated by system) title: Title of this tracking info (generated by system)
notes: Associated notes (input by user) notes: Associated notes (input by user)
URL: Optional URL to external page link: Optional URL to external page
user: The user associated with this tracking info user: The user associated with this tracking info
quantity: The StockItem quantity at this point in time quantity: The StockItem quantity at this point in time
""" """
@ -811,7 +811,7 @@ class StockItemTracking(models.Model):
notes = models.CharField(blank=True, max_length=512, help_text=_('Entry notes')) notes = models.CharField(blank=True, max_length=512, help_text=_('Entry notes'))
URL = InvenTreeURLField(blank=True, help_text=_('Link to external page for further information')) link = InvenTreeURLField(blank=True, help_text=_('Link to external page for further information'))
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True) user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)

View File

@ -80,22 +80,23 @@ class StockItemSerializer(InvenTreeModelSerializer):
class Meta: class Meta:
model = StockItem model = StockItem
fields = [ fields = [
'pk', 'batch',
'url', 'in_stock',
'link',
'location',
'location_detail',
'notes',
'part', 'part',
'part_detail', 'part_detail',
'part_name', 'part_name',
'part_image', 'part_image',
'supplier_part', 'pk',
'location',
'location_detail',
'in_stock',
'quantity', 'quantity',
'serial', 'serial',
'batch', 'supplier_part',
'status', 'status',
'status_text', 'status_text',
'notes', 'url',
] ]
""" These fields are read-only in this context. """ These fields are read-only in this context.
@ -155,7 +156,7 @@ class StockTrackingSerializer(InvenTreeModelSerializer):
'date', 'date',
'title', 'title',
'notes', 'notes',
'URL', 'link',
'quantity', 'quantity',
'user', 'user',
'system', 'system',

View File

@ -74,6 +74,7 @@
<div class='col-sm-6'> <div class='col-sm-6'>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<td><span class='fas fa-shapes'></span></td>
<td>Part</td> <td>Part</td>
<td> <td>
{% include "hover_image.html" with image=item.part.image hover=True %} {% include "hover_image.html" with image=item.part.image hover=True %}
@ -82,71 +83,84 @@
</tr> </tr>
{% if item.belongs_to %} {% if item.belongs_to %}
<tr> <tr>
<td></td>
<td>{% trans "Belongs To" %}</td> <td>{% trans "Belongs To" %}</td>
<td><a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a></td> <td><a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a></td>
</tr> </tr>
{% elif item.location %} {% elif item.location %}
<tr> <tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "Location" %}</td> <td>{% trans "Location" %}</td>
<td><a href="{% url 'stock-location-detail' item.location.id %}">{{ item.location.name }}</a></td> <td><a href="{% url 'stock-location-detail' item.location.id %}">{{ item.location.name }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.serialized %} {% if item.serialized %}
<tr> <tr>
<td></td>
<td>{% trans "Serial Number" %}</td> <td>{% trans "Serial Number" %}</td>
<td>{{ item.serial }}</td> <td>{{ item.serial }}</td>
</tr> </tr>
{% else %} {% else %}
<tr> <tr>
<td></td>
<td>{% trans "Quantity" %}</td> <td>{% trans "Quantity" %}</td>
<td>{% decimal item.quantity %} {% if item.part.units %}{{ item.part.units }}{% endif %}</td> <td>{% decimal item.quantity %} {% if item.part.units %}{{ item.part.units }}{% endif %}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.batch %} {% if item.batch %}
<tr> <tr>
<td></td>
<td>{% trans "Batch" %}</td> <td>{% trans "Batch" %}</td>
<td>{{ item.batch }}</td> <td>{{ item.batch }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.build %} {% if item.build %}
<tr> <tr>
<td><span class='fas fa-tools'></span></td>
<td>{% trans "Build" %}</td> <td>{% trans "Build" %}</td>
<td><a href="{% url 'build-detail' item.build.id %}">{{ item.build }}</a></td> <td><a href="{% url 'build-detail' item.build.id %}">{{ item.build }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.purchase_order %} {% if item.purchase_order %}
<tr> <tr>
<td></td>
<td>{% trans "Purchase Order" %}</td> <td>{% trans "Purchase Order" %}</td>
<td><a href="{% url 'po-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td> <td><a href="{% url 'po-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.customer %} {% if item.customer %}
<tr> <tr>
<td></td>
<td>{% trans "Customer" %}</td> <td>{% trans "Customer" %}</td>
<td>{{ item.customer.name }}</td> <td>{{ item.customer.name }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.URL %} {% if item.link %}
<tr> <tr>
<td>{% trans "URL" %}</td> <td><span class='fas fa-link'></span>
<td><a href="{{ item.URL }}">{{ item.URL }}</a></td> <td>{% trans "External Link" %}</td>
<td><a href="{{ item.link }}">{{ item.link }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.supplier_part %} {% if item.supplier_part %}
<tr> <tr>
<td><span class='fas fa-industry'></span></td>
<td>{% trans "Supplier" %}</td> <td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' item.supplier_part.supplier.id %}">{{ item.supplier_part.supplier.name }}</a></td> <td><a href="{% url 'company-detail' item.supplier_part.supplier.id %}">{{ item.supplier_part.supplier.name }}</a></td>
</tr> </tr>
<tr> <tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Supplier Part" %}</td> <td>{% trans "Supplier Part" %}</td>
<td><a href="{% url 'supplier-part-detail' item.supplier_part.id %}">{{ item.supplier_part.SKU }}</a></td> <td><a href="{% url 'supplier-part-detail' item.supplier_part.id %}">{{ item.supplier_part.SKU }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
<tr> <tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Last Updated" %}</td> <td>{% trans "Last Updated" %}</td>
<td>{{ item.updated }}</td> <td>{{ item.updated }}</td>
</tr> </tr>
<tr> <tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Last Stocktake" %}</td> <td>{% trans "Last Stocktake" %}</td>
{% if item.stocktake_date %} {% if item.stocktake_date %}
<td>{{ item.stocktake_date }} <span class='badge'>{{ item.stocktake_user }}</span></td> <td>{{ item.stocktake_date }} <span class='badge'>{{ item.stocktake_user }}</span></td>
@ -155,6 +169,7 @@
{% endif %} {% endif %}
</tr> </tr>
<tr> <tr>
<td><span class='fas fa-info'></span></td>
<td>{% trans "Status" %}</td> <td>{% trans "Status" %}</td>
<td>{{ item.get_status_display }}</td> <td>{{ item.get_status_display }}</td>
</tr> </tr>