Merge pull request #858 from SchrodingersGat/stock-table-ipn

Add "IPN" column to stock list table
This commit is contained in:
Oliver 2020-06-06 08:58:59 +10:00 committed by GitHub
commit b2c302cb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 22 deletions

View File

@ -107,8 +107,6 @@ $.fn.inventreeTable = function(options) {
function customGroupSorter(sortName, sortOrder, sortData) {
console.log('got here');
var order = sortOrder === 'desc' ? -1 : 1;
sortData.sort(function(a, b) {

View File

@ -111,10 +111,6 @@ src="{% static 'img/blank_image.png' %}"
</table>
{% endblock %}
{% block js_load %}
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}
{% block js_ready %}
$("#build-edit").click(function () {

View File

@ -14,11 +14,6 @@
{% endblock %}
{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}
{% block js_ready %}
{{ block.super }}

View File

@ -103,6 +103,9 @@ class PartBriefSerializer(InvenTreeModelSerializer):
model = Part
fields = [
'pk',
'IPN',
'name',
'revision',
'full_name',
'description',
'thumbnail',

View File

@ -26,12 +26,6 @@ InvenTree | {% trans "Part List" %}
{% endblock %}
{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/part.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}
{% block js_ready %}
{{ block.super }}

View File

@ -22,11 +22,6 @@ InvenTree | Stock
{% endif %}
{% endblock %}
{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadTree("{% url 'api-stock-tree' %}",

View File

@ -262,6 +262,7 @@ function loadStockTable(table, options) {
customSort: customGroupSorter,
groupBy: true,
original: original,
showColumns: true,
groupByField: options.groupByField || 'part',
groupByFormatter: function(field, id, data) {
@ -273,6 +274,9 @@ function loadStockTable(table, options) {
return imageHoverIcon(row.part_detail.thumbnail) + name + ' <i>(' + data.length + ' items)</i>';
}
else if (field == 'IPN') {
return row.part_detail.IPN;
}
else if (field == 'part_description') {
return row.part_detail.description;
}
@ -403,6 +407,15 @@ function loadStockTable(table, options) {
field: 'pk',
title: 'ID',
visible: false,
switchable: false,
},
{
field: 'IPN',
title: 'IPN',
sortable: true,
formatter: function(value, row, index, field) {
return row.part_detail.IPN;
},
},
{
field: 'part_name',