Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Oliver Walters 2021-07-18 23:00:16 +10:00
commit ba9c1345d4
11 changed files with 49 additions and 15 deletions

View File

@ -132,7 +132,7 @@ class POLineItemSerializer(InvenTreeModelSerializer):
purchase_price_string = serializers.CharField(source='purchase_price', read_only=True) purchase_price_string = serializers.CharField(source='purchase_price', read_only=True)
destination = LocationBriefSerializer(source='get_destination', read_only=True) destination_detail = LocationBriefSerializer(source='get_destination', read_only=True)
purchase_price_currency = serializers.ChoiceField( purchase_price_currency = serializers.ChoiceField(
choices=currency_code_mappings(), choices=currency_code_mappings(),
@ -156,6 +156,7 @@ class POLineItemSerializer(InvenTreeModelSerializer):
'purchase_price_currency', 'purchase_price_currency',
'purchase_price_string', 'purchase_price_string',
'destination', 'destination',
'destination_detail',
] ]

View File

@ -170,6 +170,7 @@ $("#edit-order").click(function() {
supplier: { supplier: {
}, },
{% endif %} {% endif %}
supplier_reference: {},
description: {}, description: {},
target_date: { target_date: {
icon: 'fa-calendar-alt', icon: 'fa-calendar-alt',

View File

@ -401,8 +401,15 @@ $("#po-table").inventreeTable({
} }
}, },
{ {
field: 'destination.pathstring', field: 'destination',
title: '{% trans "Destination" %}', title: '{% trans "Destination" %}',
formatter: function(value, row) {
if (value) {
return renderLink(row.destination_detail.pathstring, `/stock/location/${value}/`);
} else {
return '-';
}
}
}, },
{ {
field: 'notes', field: 'notes',

View File

@ -163,6 +163,7 @@ $("#edit-order").click(function() {
customer: { customer: {
}, },
{% endif %} {% endif %}
customer_reference: {},
description: {}, description: {},
target_date: { target_date: {
icon: 'fa-calendar-alt', icon: 'fa-calendar-alt',

View File

@ -118,9 +118,17 @@ class CategoryList(generics.ListCreateAPIView):
ordering_fields = [ ordering_fields = [
'name', 'name',
'level',
'tree_id',
'lft',
] ]
ordering = 'name' # Use hierarchical ordering by default
ordering = [
'tree_id',
'lft',
'name'
]
search_fields = [ search_fields = [
'name', 'name',

View File

@ -32,6 +32,8 @@ class CategorySerializer(InvenTreeModelSerializer):
parts = serializers.IntegerField(source='item_count', read_only=True) parts = serializers.IntegerField(source='item_count', read_only=True)
level = serializers.IntegerField(read_only=True)
class Meta: class Meta:
model = PartCategory model = PartCategory
fields = [ fields = [
@ -40,10 +42,11 @@ class CategorySerializer(InvenTreeModelSerializer):
'description', 'description',
'default_location', 'default_location',
'default_keywords', 'default_keywords',
'pathstring', 'level',
'url',
'parent', 'parent',
'parts', 'parts',
'pathstring',
'url',
] ]

View File

@ -363,6 +363,15 @@ class StockLocationList(generics.ListCreateAPIView):
ordering_fields = [ ordering_fields = [
'name', 'name',
'items', 'items',
'level',
'tree_id',
'lft',
]
ordering = [
'tree_id',
'lft',
'name',
] ]

View File

@ -260,12 +260,15 @@ class LocationSerializer(InvenTreeModelSerializer):
items = serializers.IntegerField(source='item_count', read_only=True) items = serializers.IntegerField(source='item_count', read_only=True)
level = serializers.IntegerField(read_only=True)
class Meta: class Meta:
model = StockLocation model = StockLocation
fields = [ fields = [
'pk', 'pk',
'url', 'url',
'name', 'name',
'level',
'description', 'description',
'parent', 'parent',
'pathstring', 'pathstring',

View File

@ -765,6 +765,9 @@ function attachSecondaryModal(modal, options) {
function attachSecondaries(modal, secondaries) { function attachSecondaries(modal, secondaries) {
/* Attach a provided list of secondary modals */ /* Attach a provided list of secondary modals */
// 2021-07-18 - Secondary modals will be disabled for now, until they are re-implemented in the "API forms" architecture
return;
for (var i = 0; i < secondaries.length; i++) { for (var i = 0; i < secondaries.length; i++) {
attachSecondaryModal(modal, secondaries[i]); attachSecondaryModal(modal, secondaries[i]);
} }

View File

@ -67,7 +67,9 @@ function renderStockItem(name, data, parameters, options) {
// Renderer for "StockLocation" model // Renderer for "StockLocation" model
function renderStockLocation(name, data, parameters, options) { function renderStockLocation(name, data, parameters, options) {
var html = `<span>${data.name}</span>`; var level = '- '.repeat(data.level);
var html = `<span>${level}${data.pathstring}</span>`;
if (data.description) { if (data.description) {
html += ` - <i>${data.description}</i>`; html += ` - <i>${data.description}</i>`;
@ -75,10 +77,6 @@ function renderStockLocation(name, data, parameters, options) {
html += `<span class='float-right'>{% trans "Location ID" %}: ${data.pk}</span>`; html += `<span class='float-right'>{% trans "Location ID" %}: ${data.pk}</span>`;
if (data.pathstring) {
html += `<p><small>${data.pathstring}</small></p>`;
}
return html; return html;
} }
@ -154,7 +152,9 @@ function renderOwner(name, data, parameters, options) {
// Renderer for "PartCategory" model // Renderer for "PartCategory" model
function renderPartCategory(name, data, parameters, options) { function renderPartCategory(name, data, parameters, options) {
var html = `<span><b>${data.name}</b></span>`; var level = '- '.repeat(data.level);
var html = `<span>${level}${data.pathstring}</span>`;
if (data.description) { if (data.description) {
html += ` - <i>${data.description}</i>`; html += ` - <i>${data.description}</i>`;
@ -162,10 +162,6 @@ function renderPartCategory(name, data, parameters, options) {
html += `<span class='float-right'>{% trans "Category ID" %}: ${data.pk}</span>`; html += `<span class='float-right'>{% trans "Category ID" %}: ${data.pk}</span>`;
if (data.pathstring) {
html += `<p><small>${data.pathstring}</small></p>`;
}
return html; return html;
} }

View File

@ -14,6 +14,7 @@ function createSalesOrder(options={}) {
customer: { customer: {
value: options.customer, value: options.customer,
}, },
customer_reference: {},
description: {}, description: {},
target_date: { target_date: {
icon: 'fa-calendar-alt', icon: 'fa-calendar-alt',
@ -44,6 +45,7 @@ function createPurchaseOrder(options={}) {
supplier: { supplier: {
value: options.supplier, value: options.supplier,
}, },
supplier_reference: {},
description: {}, description: {},
target_date: { target_date: {
icon: 'fa-calendar-alt', icon: 'fa-calendar-alt',