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 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 # Increment this number whenever there is a significant change to the API that any clients need to know about
INVENTREE_API_VERSION = 2 INVENTREE_API_VERSION = 2

View File

@ -38,6 +38,22 @@ class BuildList(generics.ListCreateAPIView):
'sales_order', '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): def get_queryset(self):
""" """
Override the queryset filtering, Override the queryset filtering,

View File

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

View File

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

View File

@ -56,10 +56,13 @@ class CompanyList(generics.ListCreateAPIView):
search_fields = [ search_fields = [
'name', 'name',
'description', 'description',
'website',
] ]
ordering_fields = [ ordering_fields = [
'name', 'name',
'parts_supplied',
'parts_manufactured',
] ]
ordering = 'name' 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', 'supplier',
] ]
search_fields = [
'reference',
'supplier__name',
'supplier_reference',
'description',
]
ordering_fields = [ ordering_fields = [
'creation_date', 'creation_date',
'reference', 'reference',
'supplier__name',
'target_date',
'line_items',
'status',
] ]
ordering = '-creation_date' ordering = '-creation_date'
@ -351,7 +362,20 @@ class SOList(generics.ListCreateAPIView):
ordering_fields = [ ordering_fields = [
'creation_date', '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' ordering = '-creation_date'

View File

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

View File

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

View File

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

View File

@ -186,7 +186,7 @@ class StockLocationEdit(AjaxUpdateView):
# Is ownership control enabled? # Is ownership control enabled?
stock_ownership_control = InvenTreeSetting.get_setting('STOCK_OWNERSHIP_CONTROL') stock_ownership_control = InvenTreeSetting.get_setting('STOCK_OWNERSHIP_CONTROL')
if stock_ownership_control: if stock_ownership_control and self.object.owner:
# Get authorized users # Get authorized users
authorized_owners = self.object.owner.get_related_owners() 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 # Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_enabled(): if not common.settings.stock_expiry_enabled():
form.fields.pop('expiry_date') form.fields['expiry_date'].widget = HiddenInput()
item = self.get_object() item = self.get_object()
@ -1581,7 +1581,7 @@ class StockItemCreate(AjaxCreateView):
# Hide the "expiry date" field if the feature is not enabled # Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_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) 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", { loadBuildTable("#table-build-pending", {
url: "{% url 'api-build-list' %}", url: "{% url 'api-build-list' %}",
params: { params: {
part_detail: true,
active: true, active: true,
}, },
disableFilters: true, disableFilters: true,
@ -194,7 +193,6 @@ loadBuildTable("#table-build-pending", {
loadBuildTable("#table-build-overdue", { loadBuildTable("#table-build-overdue", {
url: "{% url 'api-build-list' %}", url: "{% url 'api-build-list' %}",
params: { params: {
part_detail: true,
overdue: true, overdue: true,
}, },
disableFilters: true, disableFilters: true,

View File

@ -162,6 +162,20 @@ InvenTree | {% trans "Search Results" %}
{% endif %} {% 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 %} {% if roles.stock.view %}
addItemTitle('{% trans "Stock" %}'); 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'); addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", { 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 %}
{% endif %} {% endif %}

View File

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

View File

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

View File

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