Merge pull request #1006 from SchrodingersGat/install_into

UI stuff
This commit is contained in:
Oliver 2020-09-30 08:03:34 +10:00 committed by GitHub
commit 064a142d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 95 additions and 9 deletions

View File

@ -20,6 +20,12 @@ class BuildAdmin(ImportExportModelAdmin):
'notes', 'notes',
) )
search_fields = [
'title',
'part__name',
'part__description',
]
class BuildItemAdmin(admin.ModelAdmin): class BuildItemAdmin(admin.ModelAdmin):

View File

@ -33,7 +33,12 @@ src="{% static 'img/blank_image.png' %}"
{% block page_data %} {% block page_data %}
<h3>{% trans "Build" %} {% build_status_label build.status large=True %}</h3> <h3>{% trans "Build" %} {% build_status_label build.status large=True %}</h3>
<hr> <hr>
<h4>{{ build.quantity }} x {{ build.part.full_name }}</h4> <h4>
{{ build.quantity }} x {{ build.part.full_name }}
{% if user.is_staff %}
<a href="{% url 'admin:build_build_change' build.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<div class='btn-row'> <div class='btn-row'>
<div class='btn-group action-buttons'> <div class='btn-group action-buttons'>
<button type='button' class='btn btn-default' id='build-edit' title='Edit Build'> <button type='button' class='btn btn-default' id='build-edit' title='Edit Build'>

View File

@ -32,6 +32,11 @@ class CompanyAdmin(ImportExportModelAdmin):
list_display = ('name', 'website', 'contact') list_display = ('name', 'website', 'contact')
search_fields = [
'name',
'description',
]
class SupplierPartResource(ModelResource): class SupplierPartResource(ModelResource):
""" Class for managing SupplierPart data import/export """ """ Class for managing SupplierPart data import/export """
@ -57,6 +62,13 @@ class SupplierPartAdmin(ImportExportModelAdmin):
list_display = ('part', 'supplier', 'SKU') list_display = ('part', 'supplier', 'SKU')
search_fields = [
'company__name',
'part__name',
'MPN',
'SKU',
]
class SupplierPriceBreakResource(ModelResource): class SupplierPriceBreakResource(ModelResource):
""" Class for managing SupplierPriceBreak data import/export """ """ Class for managing SupplierPriceBreak data import/export """

View File

@ -21,7 +21,12 @@ InvenTree | {% trans "Company" %} - {{ company.name }}
{% block page_data %} {% block page_data %}
<h3>{% trans "Company" %}</h3> <h3>{% trans "Company" %}</h3>
<hr> <hr>
<h4>{{ company.name }}</h4> <h4>
{{ company.name }}
{% if user.is_staff %}
<a href="{% url 'admin:company_company_change' company.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<p>{{ company.description }}</p> <p>{{ company.description }}</p>
<div class='btn-group action-buttons'> <div class='btn-group action-buttons'>
{% if company.is_supplier %} {% if company.is_supplier %}

View File

@ -23,6 +23,12 @@ class PurchaseOrderAdmin(ImportExportModelAdmin):
'creation_date' 'creation_date'
) )
search_fields = [
'reference',
'supplier__name',
'description',
]
class SalesOrderAdmin(ImportExportModelAdmin): class SalesOrderAdmin(ImportExportModelAdmin):
@ -34,6 +40,12 @@ class SalesOrderAdmin(ImportExportModelAdmin):
'creation_date', 'creation_date',
) )
search_fields = [
'reference',
'customer__name',
'description',
]
class POLineItemResource(ModelResource): class POLineItemResource(ModelResource):
""" Class for managing import / export of POLineItem data """ """ Class for managing import / export of POLineItem data """

View File

@ -7,7 +7,12 @@
<div class='row'> <div class='row'>
<div class='col-sm-6'> <div class='col-sm-6'>
{% if category %} {% if category %}
<h3>{{ category.name }}</h3> <h3>
{{ category.name }}
{% if user.is_staff %}
<a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ category.description }}</p> <p>{{ category.description }}</p>
{% else %} {% else %}
<h3>{% trans "Part Categories" %}</h3> <h3>{% trans "Part Categories" %}</h3>

View File

@ -28,6 +28,9 @@
<div class="media-body"> <div class="media-body">
<h3> <h3>
{{ part.full_name }} {{ part.full_name }}
{% if user.is_staff %}
<a href="{% url 'admin:part_part_change' part.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
{% if not part.active %} {% if not part.active %}
<div class='label label-large label-large-red'> <div class='label label-large label-large-red'>
{% trans 'Inactive' %} {% trans 'Inactive' %}

View File

@ -117,6 +117,14 @@ class StockItemAdmin(ImportExportModelAdmin):
list_display = ('part', 'quantity', 'location', 'status', 'updated') list_display = ('part', 'quantity', 'location', 'status', 'updated')
# A list of search fields which can be used for lookup on matching 'autocomplete' fields
search_fields = [
'part__name',
'part__description',
'serial',
'batch',
]
class StockAttachmentAdmin(admin.ModelAdmin): class StockAttachmentAdmin(admin.ModelAdmin):

View File

@ -61,9 +61,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<hr> <hr>
<h4> <h4>
{% if item.serialized %} {% if item.serialized %}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name}}</a> # {{ item.serial }} <a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name}}</a> # {{ item.serial }}
{% else %} {% else %}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name }}</a> &times {% decimal item.quantity %} <a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name }}</a> &times {% decimal item.quantity %}
{% endif %}
{% if user.is_staff %}
<a href="{% url 'admin:stock_stockitem_change' item.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %} {% endif %}
</h4> </h4>
@ -107,6 +110,11 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.customer %} {% if item.customer %}
<li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li> <li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li>
{% endif %} {% endif %}
{% if item.belongs_to %}
<li>
<a href='#' id='stock-uninstall' title='{% trans "Uninstall stock item" %}'><span class='fas fa-unlink'></span> {% trans "Uninstall" %}</a>
</li>
{% endif %}
</ul> </ul>
</div> </div>
<!-- Edit stock item --> <!-- Edit stock item -->
@ -165,8 +173,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.belongs_to %} {% if item.belongs_to %}
<tr> <tr>
<td><span class='fas fa-box'></span></td> <td><span class='fas fa-box'></span></td>
<td>{% trans "Belongs To" %}</td> <td>
<td><a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a></td> {% trans "Installed In" %}
</td>
<td>
<a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a>
</td>
</tr> </tr>
{% elif item.sales_order %} {% elif item.sales_order %}
<tr> <tr>
@ -301,6 +313,19 @@ $("#stock-serialize").click(function() {
); );
}); });
$('#stock-uninstall').click(function() {
launchModalForm(
"{% url 'stock-item-uninstall' %}",
{
data: {
'items[]': [{{ item.pk}}],
},
reload: true,
}
);
});
$("#stock-test-report").click(function() { $("#stock-test-report").click(function() {
launchModalForm( launchModalForm(
"{% url 'stock-item-test-report-select' item.id %}", "{% url 'stock-item-test-report-select' item.id %}",

View File

@ -128,7 +128,7 @@ $('#installed-table').inventreeTable({
var html = `<div class='btn-group float-right' role='group'>`; var html = `<div class='btn-group float-right' role='group'>`;
html += makeIconButton('fa-trash-alt icon-red', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall item" %}');
html += `</div>`; html += `</div>`;

View File

@ -6,7 +6,12 @@
<div class='row'> <div class='row'>
<div class='col-sm-6'> <div class='col-sm-6'>
{% if location %} {% if location %}
<h3>{{ location.name }}</h3> <h3>
{{ location.name }}
{% if user.is_staff %}
<a href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ location.description }}</p> <p>{{ location.description }}</p>
{% else %} {% else %}
<h3>{% trans "Stock" %}</h3> <h3>{% trans "Stock" %}</h3>