Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2021-03-06 20:01:48 +11:00
commit 73a13b3924
19 changed files with 1703 additions and 1614 deletions

View File

@ -7,7 +7,7 @@ import django
import common.models
INVENTREE_SW_VERSION = "0.1.7 pre"
INVENTREE_SW_VERSION = "0.1.8 pre"
# Increment this number whenever there is a significant change to the API that any clients need to know about
INVENTREE_API_VERSION = 2

View File

@ -38,6 +38,22 @@ class BuildList(generics.ListCreateAPIView):
'sales_order',
]
ordering_fields = [
'reference',
'part__name',
'status',
'creation_date',
'target_date',
'completion_date',
'quantity',
]
search_fields = [
'reference',
'part__name',
'title',
]
def get_queryset(self):
"""
Override the queryset filtering,

View File

@ -33,7 +33,6 @@ loadBuildTable($('#sub-build-table'), {
url: '{% url "api-build-list" %}',
filterTarget: "#filter-list-sub-build",
params: {
part_detail: true,
ancestor: {{ build.pk }},
}
});

View File

@ -179,9 +179,6 @@ $("#new-build").click(function() {
loadBuildTable($("#build-table"), {
url: "{% url 'api-build-list' %}",
params: {
part_detail: "true",
},
});
$('#multi-build-print').click(function() {

View File

@ -56,10 +56,13 @@ class CompanyList(generics.ListCreateAPIView):
search_fields = [
'name',
'description',
'website',
]
ordering_fields = [
'name',
'parts_supplied',
'parts_manufactured',
]
ordering = 'name'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -137,9 +137,20 @@ class POList(generics.ListCreateAPIView):
'supplier',
]
search_fields = [
'reference',
'supplier__name',
'supplier_reference',
'description',
]
ordering_fields = [
'creation_date',
'reference',
'supplier__name',
'target_date',
'line_items',
'status',
]
ordering = '-creation_date'
@ -351,7 +362,20 @@ class SOList(generics.ListCreateAPIView):
ordering_fields = [
'creation_date',
'reference'
'reference',
'customer__name',
'customer_reference',
'status',
'target_date',
'line_items',
'shipment_date',
]
search_fields = [
'customer__name',
'reference',
'description',
'customer_reference',
]
ordering = '-creation_date'

View File

@ -27,7 +27,6 @@ loadBuildTable($("#builds-table"), {
url: "{% url 'api-build-list' %}",
params: {
sales_order: {{ order.id }},
part_detail: true,
},
});

View File

@ -43,7 +43,6 @@
loadBuildTable($("#build-table"), {
url: "{% url 'api-build-list' %}",
params: {
part_detail: "true",
part: {{ part.id }},
}
});

View File

@ -613,7 +613,7 @@ class PartCreate(AjaxCreateView):
# Hide the "default expiry" field if the feature is not enabled
if not inventree_settings.stock_expiry_enabled():
form.fields.pop('default_expiry')
form.fields['default_expiry'].widget = HiddenInput()
# Hide the default_supplier field (there are no matching supplier parts yet!)
form.fields['default_supplier'].widget = HiddenInput()
@ -904,7 +904,7 @@ class PartEdit(AjaxUpdateView):
# Hide the "default expiry" field if the feature is not enabled
if not inventree_settings.stock_expiry_enabled():
form.fields.pop('default_expiry')
form.fields['default_expiry'].widget = HiddenInput()
part = self.get_object()

View File

@ -186,7 +186,7 @@ class StockLocationEdit(AjaxUpdateView):
# Is ownership control enabled?
stock_ownership_control = InvenTreeSetting.get_setting('STOCK_OWNERSHIP_CONTROL')
if stock_ownership_control:
if stock_ownership_control and self.object.owner:
# Get authorized users
authorized_owners = self.object.owner.get_related_owners()
@ -1232,7 +1232,7 @@ class StockItemEdit(AjaxUpdateView):
# Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_enabled():
form.fields.pop('expiry_date')
form.fields['expiry_date'].widget = HiddenInput()
item = self.get_object()
@ -1581,7 +1581,7 @@ class StockItemCreate(AjaxCreateView):
# Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_enabled():
form.fields.pop('expiry_date')
form.fields['expiry_date'].widget = HiddenInput()
part = self.get_part(form=form)

View File

@ -185,7 +185,6 @@ addHeaderAction('build-overdue', '{% trans "Overdue Build Orders" %}', 'fa-calen
loadBuildTable("#table-build-pending", {
url: "{% url 'api-build-list' %}",
params: {
part_detail: true,
active: true,
},
disableFilters: true,
@ -194,7 +193,6 @@ loadBuildTable("#table-build-pending", {
loadBuildTable("#table-build-overdue", {
url: "{% url 'api-build-list' %}",
params: {
part_detail: true,
overdue: true,
},
disableFilters: true,

View File

@ -162,6 +162,20 @@ InvenTree | {% trans "Search Results" %}
{% endif %}
{% if roles.build.view %}
addItemTitle('{% trans "Build" %}');
addItem('build-order', '{% trans "Build Orders" %}', 'fa-tools');
loadBuildTable('#table-build-order', {
params: {
search: '{{ query }}',
}
});
{% endif %}
{% if roles.stock.view %}
addItemTitle('{% trans "Stock" %}');
@ -283,6 +297,14 @@ InvenTree | {% trans "Search Results" %}
}
});
addItem('purchase-order', '{% trans "Purchase Orders" %}', 'fa-shopping-cart');
loadPurchaseOrderTable('#table-purchase-order', {
params: {
search: '{{ query }}',
}
});
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
@ -305,6 +327,14 @@ InvenTree | {% trans "Search Results" %}
}
});
addItem('sales-orders', '{% trans "Sales Orders" %}', 'fa-truck');
loadSalesOrderTable('#table-sales-orders', {
params: {
search: '{{ query }}',
}
});
{% endif %}
{% endif %}

View File

@ -610,6 +610,8 @@ function loadBuildTable(table, options) {
var filters = {};
params['part_detail'] = true;
if (!options.disableFilters) {
filters = loadTableFilters("build");
}
@ -618,6 +620,8 @@ function loadBuildTable(table, options) {
filters[key] = params[key];
}
options.url = options.url || '{% url "api-build-list" %}';
var filterTarget = options.filterTarget || null;
setupFilterList("build", table, filterTarget);
@ -671,12 +675,12 @@ function loadBuildTable(table, options) {
{
field: 'title',
title: '{% trans "Description" %}',
sortable: true,
},
{
field: 'part',
title: '{% trans "Part" %}',
sortable: true,
sortName: 'part__name',
formatter: function(value, row, index, field) {
var html = imageHoverIcon(row.part_detail.thumbnail);

View File

@ -54,7 +54,6 @@ function loadCompanyTable(table, url, options={}) {
{
field: 'description',
title: '{% trans "Description" %}',
sortable: true,
},
{
field: 'website',

View File

@ -124,6 +124,8 @@ function loadPurchaseOrderTable(table, options) {
filters[key] = options.params[key];
}
options.url = options.url || '{% url "api-po-list" %}';
setupFilterList("purchaseorder", $(table));
$(table).inventreeTable({
@ -167,6 +169,7 @@ function loadPurchaseOrderTable(table, options) {
field: 'supplier_detail',
title: '{% trans "Supplier" %}',
sortable: true,
sortName: 'supplier__name',
formatter: function(value, row, index, field) {
return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`);
}
@ -174,12 +177,10 @@ function loadPurchaseOrderTable(table, options) {
{
field: 'supplier_reference',
title: '{% trans "Supplier Reference" %}',
sortable: true,
},
{
field: 'description',
title: '{% trans "Description" %}',
sortable: true,
},
{
field: 'status',
@ -219,6 +220,8 @@ function loadSalesOrderTable(table, options) {
filters[key] = options.params[key];
}
options.url = options.url || '{% url "api-so-list" %}';
setupFilterList("salesorder", $(table));
$(table).inventreeTable({
@ -259,6 +262,7 @@ function loadSalesOrderTable(table, options) {
},
{
sortable: true,
sortName: 'customer__name',
field: 'customer_detail',
title: '{% trans "Customer" %}',
formatter: function(value, row, index, field) {
@ -266,12 +270,12 @@ function loadSalesOrderTable(table, options) {
}
},
{
sortable: true,
field: 'customer_reference',
title: '{% trans "Customer Reference" %}',
sotrable: true,
},
{
sortable: true,
sortable: false,
field: 'description',
title: '{% trans "Description" %}',
},