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>";
}
if (row.URL) {
html += "<br><a href='" + row.URL + "'>" + row.URL + "</a>";
if (row.link) {
html += "<br><a href='" + row.link + "'>" + row.link + "</a>";
}
return html;

View File

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

View File

@ -42,9 +42,9 @@ class CreateStockItemForm(HelperForm):
'quantity',
'batch',
'serial_numbers',
'link',
'delete_on_deplete',
'status',
'URL',
]
# Custom clean to prevent complex StockItem.clean() logic from running (yet)
@ -161,7 +161,7 @@ class EditStockItemForm(HelperForm):
'serial',
'batch',
'status',
'URL',
'link',
'delete_on_deplete',
]
@ -176,5 +176,5 @@ class TrackingEntryForm(HelperForm):
fields = [
'title',
'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
batch: Batch 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)
stocktake_date: Date of last stocktake for this item
stocktake_user: User that performed the most recent stocktake
@ -328,7 +328,7 @@ class StockItem(MPTTModel):
serial = models.PositiveIntegerField(blank=True, null=True,
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,
help_text=_('Batch code for this stock item'))
@ -793,7 +793,7 @@ class StockItemTracking(models.Model):
date: Date that this tracking info was created
title: Title of this tracking info (generated by system)
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
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'))
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)

View File

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

View File

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