Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2021-03-02 17:35:37 +11:00
commit 1c3e26036f
9 changed files with 66 additions and 15 deletions

View File

@ -48,10 +48,6 @@ script:
- rm inventree_default_db.sqlite3 - rm inventree_default_db.sqlite3
- invoke migrate - invoke migrate
- invoke import-records -f data.json - invoke import-records -f data.json
# Run linting checks on migration files (django-migration-linter)
# Run subset of linting checks on *ALL* migration files
# Run strict migration file checks on *NEW* migrations (old ones are what they are)
- cd InvenTree && python manage.py lintmigrations 79ddea50f507e34195bad635008419daac0d7a5f -q ok ignore --no-cache && cd ..
after_success: after_success:
- coveralls - coveralls

View File

@ -211,7 +211,6 @@ INSTALLED_APPS = [
'djmoney', # django-money integration 'djmoney', # django-money integration
'djmoney.contrib.exchange', # django-money exchange rates 'djmoney.contrib.exchange', # django-money exchange rates
'error_report', # Error reporting in the admin interface 'error_report', # Error reporting in the admin interface
'django_migration_linter', # Linting checking for migration files
] ]
MIDDLEWARE = CONFIG.get('middleware', [ MIDDLEWARE = CONFIG.get('middleware', [

View File

@ -10,6 +10,11 @@
{% endblock %} {% endblock %}
} }
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0mm;
}
img { img {
display: inline-block; display: inline-block;
image-rendering: pixelated; image-rendering: pixelated;

View File

@ -200,6 +200,25 @@ class POLineItemList(generics.ListCreateAPIView):
filter_backends = [ filter_backends = [
DjangoFilterBackend, DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter
]
ordering_fields = [
'part__part__name',
'part__MPN',
'part__SKU',
'reference',
'quantity',
'received',
]
search_fields = [
'part__part__name',
'part__part__description',
'part__MPN',
'part__SKU',
'reference',
] ]
filter_fields = [ filter_fields = [
@ -412,7 +431,23 @@ class SOLineItemList(generics.ListCreateAPIView):
return queryset return queryset
filter_backends = [DjangoFilterBackend] filter_backends = [
DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter
]
ordering_fields = [
'part__name',
'quantity',
'reference',
]
search_fields = [
'part__name',
'quantity',
'reference',
]
filter_fields = [ filter_fields = [
'order', 'order',

View File

@ -135,6 +135,7 @@ function setupCallbacks() {
$("#po-table").inventreeTable({ $("#po-table").inventreeTable({
onPostBody: setupCallbacks, onPostBody: setupCallbacks,
name: 'purchaseorder', name: 'purchaseorder',
sidePagination: 'server',
formatNoMatches: function() { return "{% trans 'No line items found' %}"; }, formatNoMatches: function() { return "{% trans 'No line items found' %}"; },
queryParams: { queryParams: {
order: {{ order.id }}, order: {{ order.id }},
@ -151,6 +152,7 @@ $("#po-table").inventreeTable({
{ {
field: 'part', field: 'part',
sortable: true, sortable: true,
sortName: 'part__part__name',
title: '{% trans "Part" %}', title: '{% trans "Part" %}',
switchable: false, switchable: false,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
@ -162,18 +164,24 @@ $("#po-table").inventreeTable({
}, },
}, },
{ {
sortable: true,
field: 'part_detail.description', field: 'part_detail.description',
title: '{% trans "Description" %}', title: '{% trans "Description" %}',
}, },
{ {
sortable: true, sortable: true,
sortName: 'part__SKU',
field: 'supplier_part_detail.SKU', field: 'supplier_part_detail.SKU',
title: '{% trans "Order Code" %}', title: '{% trans "SKU" %}',
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return renderLink(value, `/supplier-part/${row.part}/`); return renderLink(value, `/supplier-part/${row.part}/`);
}, },
}, },
{
sortable: true,
sortName: 'part__MPN',
field: 'supplier_part_detail.MPN',
title: '{% trans "MPN" %}',
},
{ {
sortable: true, sortable: true,
field: 'reference', field: 'reference',

View File

@ -173,6 +173,7 @@ $("#so-lines-table").inventreeTable({
part_detail: true, part_detail: true,
allocations: true, allocations: true,
}, },
sidePagination: 'server',
uniqueId: 'pk', uniqueId: 'pk',
url: "{% url 'api-so-line-list' %}", url: "{% url 'api-so-line-list' %}",
onPostBody: setupCallbacks, onPostBody: setupCallbacks,
@ -201,6 +202,7 @@ $("#so-lines-table").inventreeTable({
}, },
{ {
sortable: true, sortable: true,
sortName: 'part__name',
field: 'part', field: 'part',
title: 'Part', title: 'Part',
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
@ -222,7 +224,6 @@ $("#so-lines-table").inventreeTable({
title: 'Quantity', title: 'Quantity',
}, },
{ {
sortable: true,
field: 'allocated', field: 'allocated',
{% if order.status == SalesOrderStatus.PENDING %} {% if order.status == SalesOrderStatus.PENDING %}
title: '{% trans "Allocated" %}', title: '{% trans "Allocated" %}',

View File

@ -853,7 +853,9 @@ class StockList(generics.ListCreateAPIView):
'status', 'status',
] ]
ordering = ['part__name'] ordering = [
'part__name'
]
search_fields = [ search_fields = [
'serial', 'serial',

View File

@ -145,9 +145,6 @@ $.fn.inventreeTable = function(options) {
var filters = options.queryParams || options.filters || {}; var filters = options.queryParams || options.filters || {};
options.queryParams = function(params) { options.queryParams = function(params) {
for (var key in filters) {
params[key] = filters[key];
}
// Override the way that we ask the server to sort results // Override the way that we ask the server to sort results
// It seems bootstrap-table does not offer a "native" way to do this... // It seems bootstrap-table does not offer a "native" way to do this...
@ -170,6 +167,15 @@ $.fn.inventreeTable = function(options) {
} }
for (var key in filters) {
params[key] = filters[key];
}
// Add "order" back in (if it was originally specified by InvenTree)
// Annoyingly, "order" shadows some field names in InvenTree...
if ('order' in filters) {
params['order'] = filters['order'];
}
return params; return params;
} }

View File

@ -28,7 +28,6 @@ django-money==1.1 # Django app for currency management
certifi # Certifi is (most likely) installed through one of the requirements above certifi # Certifi is (most likely) installed through one of the requirements above
django-error-report==0.2.0 # Error report viewer for the admin interface django-error-report==0.2.0 # Error report viewer for the admin interface
django-test-migrations==1.1.0 # Unit testing for database migrations django-test-migrations==1.1.0 # Unit testing for database migrations
django-migration-linter==2.5.0 # Linting checks for database migrations
python-barcode[images]==0.13.1 # Barcode generator python-barcode[images]==0.13.1 # Barcode generator
qrcode[pil]==6.1 # QR code generator qrcode[pil]==6.1 # QR code generator