2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Merge branch 'master' into partial-shipment

# Conflicts:
#	InvenTree/build/serializers.py
#	InvenTree/order/templates/order/so_sidebar.html
This commit is contained in:
Oliver
2021-11-26 08:25:51 +11:00
129 changed files with 66929 additions and 54543 deletions

View File

@ -250,18 +250,18 @@ $("#param-table").inventreeTable({
columns: [
{
field: 'pk',
title: 'ID',
title: '{% trans "ID" %}',
visible: false,
switchable: false,
},
{
field: 'name',
title: 'Name',
title: '{% trans "Name" %}',
sortable: 'true',
},
{
field: 'units',
title: 'Units',
title: '{% trans "Units" %}',
sortable: 'true',
},
{

View File

@ -2,29 +2,48 @@
{% load static %}
{% load inventree_extras %}
{% include "sidebar_header.html" with text="User Settings" icon='fa-user' %}
{% trans "User Settings" as text %}
{% include "sidebar_header.html" with text=text icon='fa-user' %}
{% include "sidebar_item.html" with label='account' text="Account Settings" icon="fa-cog" %}
{% include "sidebar_item.html" with label='user-display' text="Display Settings" icon="fa-desktop" %}
{% include "sidebar_item.html" with label='user-home' text="Home Page" icon="fa-home" %}
{% include "sidebar_item.html" with label='user-search' text="Search Settings" icon="fa-search" %}
{% include "sidebar_item.html" with label='user-labels' text="Label Printing" icon="fa-tag" %}
{% include "sidebar_item.html" with label='user-reports' text="Reporting" icon="fa-file-pdf" %}
{% trans "Account Settings" as text %}
{% include "sidebar_item.html" with label='account' text=text icon="fa-cog" %}
{% trans "Display Settings" as text %}
{% include "sidebar_item.html" with label='user-display' text=text icon="fa-desktop" %}
{% trans "Home Page" as text %}
{% include "sidebar_item.html" with label='user-home' text=text icon="fa-home" %}
{% trans "Search Settings" as text %}
{% include "sidebar_item.html" with label='user-search' text=text icon="fa-search" %}
{% trans "Label Printing" as text %}
{% include "sidebar_item.html" with label='user-labels' text=text icon="fa-tag" %}
{% trans "Reporting" as text %}
{% include "sidebar_item.html" with label='user-reports' text=text icon="fa-file-pdf" %}
{% if user.is_staff %}
{% include "sidebar_header.html" with text="Global Settings" icon='fa-cogs' %}
{% trans "Global Settings" as text %}
{% include "sidebar_header.html" with text=text icon='fa-cogs' %}
{% include "sidebar_item.html" with label='server' text="Server Configuration" icon="fa-server" %}
{% include "sidebar_item.html" with label='login' text="Login Settings" icon="fa-fingerprint" %}
{% include "sidebar_item.html" with label='barcodes' text="Barcode Support" icon="fa-qrcode" %}
{% include "sidebar_item.html" with label='currencies' text="Currencies" icon="fa-dollar-sign" %}
{% include "sidebar_item.html" with label='reporting' text="Reporting" icon="fa-file-pdf" %}
{% include "sidebar_item.html" with label='parts' text="Parts" icon="fa-shapes" %}
{% include "sidebar_item.html" with label='category' text="Categories" icon="fa-sitemap" %}
{% include "sidebar_item.html" with label='stock' text="Stock" icon="fa-boxes" %}
{% include "sidebar_item.html" with label='build-order' text="Build Orders" icon="fa-tools" %}
{% include "sidebar_item.html" with label='purchase-order' text="Purchase Orders" icon="fa-shopping-cart" %}
{% include "sidebar_item.html" with label='sales-order' text="Sales Orders" icon="fa-truck" %}
{% trans "Server Configuration" as text %}
{% include "sidebar_item.html" with label='server' text=text icon="fa-server" %}
{% trans "Login Settings" as text %}
{% include "sidebar_item.html" with label='login' text=text icon="fa-fingerprint" %}
{% trans "Barcode Support" as text %}
{% include "sidebar_item.html" with label='barcodes' text=text icon="fa-qrcode" %}
{% trans "Currencies" as text %}
{% include "sidebar_item.html" with label='currencies' text=text icon="fa-dollar-sign" %}
{% trans "Reporting" as text %}
{% include "sidebar_item.html" with label='reporting' text=text icon="fa-file-pdf" %}
{% trans "Parts" as text %}
{% include "sidebar_item.html" with label='parts' text=text icon="fa-shapes" %}
{% trans "Categories" as text %}
{% include "sidebar_item.html" with label='category' text=text icon="fa-sitemap" %}
{% trans "Stock" as text %}
{% include "sidebar_item.html" with label='stock' text=text icon="fa-boxes" %}
{% trans "Build Orders" as text %}
{% include "sidebar_item.html" with label='build-order' text=text icon="fa-tools" %}
{% trans "Purchase Orders" as text %}
{% include "sidebar_item.html" with label='purchase-order' text=text icon="fa-shopping-cart" %}
{% trans "Sales Orders" as text %}
{% include "sidebar_item.html" with label='sales-order' text=text icon="fa-truck" %}
{% endif %}

View File

@ -214,7 +214,7 @@
{% if ALL_LANG %}
. <a href="{% url 'settings' %}">{% trans "Show only sufficent" %}</a>
{% else %}
and hidden. <a href="?alllang">{% trans "Show them too" %}</a>
{% trans "and hidden." %} <a href="?alllang">{% trans "Show them too" %}</a>
{% endif %}
</p>
</div>

View File

@ -192,6 +192,7 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) {
</a>
</td>
<td id='description-${pk}'><em>${part.description}</em></td>
<td id='stock-${pk}'><em>${part.stock}</em></td>
<td>${buttons}</td>
</tr>
`;
@ -212,6 +213,7 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) {
<tr>
<th>{% trans "Part" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Stock" %}</th>
<th><!-- Actions --></th>
</tr>
</thead>

View File

@ -124,6 +124,7 @@ function supplierPartFields() {
part_detail: true,
manufacturer_detail: true,
},
auto_fill: true,
},
description: {},
link: {

View File

@ -273,7 +273,7 @@ function setupFilterList(tableKey, table, target) {
var element = $(target);
if (!element) {
if (!element || !element.exists()) {
console.log(`WARNING: setupFilterList could not find target '${target}'`);
return;
}

View File

@ -32,6 +32,7 @@
loadPartTable,
loadPartTestTemplateTable,
loadPartVariantTable,
loadRelatedPartsTable,
loadSellPricingChart,
loadSimplePartTable,
loadStockPricingChart,
@ -705,6 +706,97 @@ function loadPartParameterTable(table, url, options) {
}
function loadRelatedPartsTable(table, part_id, options={}) {
/*
* Load table of "related" parts
*/
options.params = options.params || {};
options.params.part = part_id;
var filters = {};
for (var key in options.params) {
filters[key] = options.params[key];
}
setupFilterList('related', $(table), options.filterTarget);
function getPart(row) {
if (row.part_1 == part_id) {
return row.part_2_detail;
} else {
return row.part_1_detail;
}
}
var columns = [
{
field: 'name',
title: '{% trans "Part" %}',
switchable: false,
formatter: function(value, row) {
var part = getPart(row);
var html = imageHoverIcon(part.thumbnail) + renderLink(part.full_name, `/part/${part.pk}/`);
html += makePartIcons(part);
return html;
}
},
{
field: 'description',
title: '{% trans "Description" %}',
formatter: function(value, row) {
return getPart(row).description;
}
},
{
field: 'actions',
title: '',
switchable: false,
formatter: function(value, row) {
var html = `<div class='btn-group float-right' role='group'>`;
html += makeIconButton('fa-trash-alt icon-red', 'button-related-delete', row.pk, '{% trans "Delete part relationship" %}');
html += '</div>';
return html;
}
}
];
$(table).inventreeTable({
url: '{% url "api-part-related-list" %}',
groupBy: false,
name: 'related',
original: options.params,
queryParams: filters,
columns: columns,
showColumns: false,
search: true,
onPostBody: function() {
$(table).find('.button-related-delete').click(function() {
var pk = $(this).attr('pk');
constructForm(`/api/part/related/${pk}/`, {
method: 'DELETE',
title: '{% trans "Delete Part Relationship" %}',
onSuccess: function() {
$(table).bootstrapTable('refresh');
}
});
});
},
});
}
function loadParametricPartTable(table, options={}) {
/* Load parametric table for part parameters
*
@ -836,6 +928,7 @@ function loadPartTable(table, url, options={}) {
* query: extra query params for API request
* buttons: If provided, link buttons to selection status of this table
* disableFilters: If true, disable custom filters
* actions: Provide a callback function to construct an "actions" column
*/
// Ensure category detail is included
@ -878,7 +971,7 @@ function loadPartTable(table, url, options={}) {
col = {
field: 'IPN',
title: 'IPN',
title: '{% trans "IPN" %}',
};
if (!options.params.ordering) {
@ -895,7 +988,7 @@ function loadPartTable(table, url, options={}) {
var name = row.full_name;
var display = imageHoverIcon(row.thumbnail) + renderLink(name, '/part/' + row.pk + '/');
var display = imageHoverIcon(row.thumbnail) + renderLink(name, `/part/${row.pk}/`);
display += makePartIcons(row);
@ -993,6 +1086,21 @@ function loadPartTable(table, url, options={}) {
}
});
// Push an "actions" column
if (options.actions) {
columns.push({
field: 'actions',
title: '',
switchable: false,
visible: true,
searchable: false,
sortable: false,
formatter: function(value, row) {
return options.actions(value, row);
}
});
}
var grid_view = options.gridView && inventreeLoad('part-grid-view') == 1;
$(table).inventreeTable({
@ -1020,6 +1128,10 @@ function loadPartTable(table, url, options={}) {
$('#view-part-grid').removeClass('btn-secondary').addClass('btn-outline-secondary');
$('#view-part-list').removeClass('btn-outline-secondary').addClass('btn-secondary');
}
if (options.onPostBody) {
options.onPostBody();
}
},
buttons: options.gridView ? [
{

View File

@ -1101,7 +1101,7 @@ function loadStockTable(table, options) {
col = {
field: 'part_detail.IPN',
title: 'IPN',
title: '{% trans "IPN" %}',
sortName: 'part__IPN',
visible: params['part_detail'],
switchable: params['part_detail'],

View File

@ -74,6 +74,12 @@ function getAvailableTableFilters(tableKey) {
};
}
// Filters for the "related parts" table
if (tableKey == 'related') {
return {
};
}
// Filters for the "used in" table
if (tableKey == 'usedin') {
return {

View File

@ -1,8 +1,8 @@
{% load i18n %}
<span title='{% trans text %}' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate bg-light" data-bs-parent="#sidebar">
<span title='{{ text }}' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate bg-light" data-bs-parent="#sidebar">
<h6>
<i class="bi bi-bootstrap"></i>
{% if icon %}<span class='sidebar-item-icon fas {{ icon }}'></span>{% endif %}
{% if text %}<span class='sidebar-item-text' style='display: none;'>{% trans text %}</span>{% endif %}
{% if text %}<span class='sidebar-item-text' style='display: none;'>{{ text }}</span>{% endif %}
</h6>
</span>
</span>

View File

@ -1,8 +1,8 @@
{% load i18n %}
<a href="#" id='select-{{ label }}' title='{% trans text %}' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate sidebar-selector" data-bs-parent="#sidebar">
<a href="#" id='select-{{ label }}' title='{{ text }}' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate sidebar-selector" data-bs-parent="#sidebar">
<i class="bi bi-bootstrap"></i>
<span class='sidebar-item-icon fas {{ icon }}'></span>
<span class='sidebar-item-text' style='display: none;'>{% trans text %}</span>
<span class='sidebar-item-icon fas {{ icon|default:"fa-circle" }}'></span>
<span class='sidebar-item-text' style='display: none;'>{{ text }}</span>
{% if badge %}
<span id='sidebar-badge-{{ label }}' class='sidebar-item-badge badge rounded-pill badge-right bg-dark'>
<span class='fas fa-spin fa-spinner'></span>

View File

@ -1,4 +1,4 @@
{% load i18n %}
<a href="{{ url }}" class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate" data-bs-parent="#sidebar">
<i class="bi bi-bootstrap"></i><span class='sidebar-item-icon fas {{ icon }}'></span><span class='sidebar-item-text' style='display: none;'>{% trans text %}</span>
<i class="bi bi-bootstrap"></i><span class='sidebar-item-icon fas {{ icon }}'></span><span class='sidebar-item-text' style='display: none;'>{{ text }}</span>
</a>