mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Display proper printing target name in the label printing modal dialog (#4727)
Fix #4717
This commit is contained in:
		@@ -471,6 +471,7 @@
 | 
			
		||||
        printLabels({
 | 
			
		||||
            items: [{{ part.pk }}],
 | 
			
		||||
            key: 'part',
 | 
			
		||||
            singular_name: '{% trans "part" %}',
 | 
			
		||||
            url: '{% url "api-part-label-list" %}',
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -496,6 +496,7 @@ $("#stock-test-report").click(function() {
 | 
			
		||||
$("#print-label").click(function() {
 | 
			
		||||
    printLabels({
 | 
			
		||||
        items: [{{ item.pk }}],
 | 
			
		||||
        singular_name: '{% trans "stock item" %}',
 | 
			
		||||
        url: '{% url "api-stockitem-label-list" %}',
 | 
			
		||||
        key: 'item',
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -284,6 +284,7 @@
 | 
			
		||||
 | 
			
		||||
        printLabels({
 | 
			
		||||
            items: locs,
 | 
			
		||||
            singular_name: '{% trans "stock location" %}',
 | 
			
		||||
            key: 'location',
 | 
			
		||||
            url: '{% url "api-stocklocation-label-list" %}',
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -889,7 +889,9 @@ function loadBuildOutputTable(build_info, options={}) {
 | 
			
		||||
        labels: {
 | 
			
		||||
            url: '{% url "api-stockitem-label-list" %}',
 | 
			
		||||
            key: 'item',
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        singular_name: '{% trans "build output" %}',
 | 
			
		||||
        plural_name: '{% trans "build outputs" %}',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    function setupBuildOutputButtonCallbacks() {
 | 
			
		||||
 
 | 
			
		||||
@@ -419,6 +419,8 @@ function setupFilterList(tableKey, table, target, options={}) {
 | 
			
		||||
 | 
			
		||||
            printLabels({
 | 
			
		||||
                items: items,
 | 
			
		||||
                singular_name: options.singular_name,
 | 
			
		||||
                plural_name: options.plural_name,
 | 
			
		||||
                url: options.labels.url,
 | 
			
		||||
                key: options.labels.key,
 | 
			
		||||
            });
 | 
			
		||||
 
 | 
			
		||||
@@ -96,10 +96,10 @@ function selectLabel(labels, items, options={}) {
 | 
			
		||||
    var html = '';
 | 
			
		||||
 | 
			
		||||
    if (items.length > 0) {
 | 
			
		||||
 | 
			
		||||
        name = items.length == 1 ? options.singular_name : options.plural_name;
 | 
			
		||||
        html += `
 | 
			
		||||
        <div class='alert alert-block alert-info'>
 | 
			
		||||
        ${items.length} {% trans "stock items selected" %}
 | 
			
		||||
        ${items.length} ${name} {% trans "selected" %}
 | 
			
		||||
        </div>`;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -208,7 +208,9 @@ function printLabels(options) {
 | 
			
		||||
                    } else {
 | 
			
		||||
                        window.open(href);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
                plural_name: options.plural_name,
 | 
			
		||||
                singular_name: options.singular_name,
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -1834,7 +1834,9 @@ function loadPartTable(table, url, options={}) {
 | 
			
		||||
        labels: {
 | 
			
		||||
            url: '{% url "api-part-label-list" %}',
 | 
			
		||||
            key: 'part',
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        singular_name: '{% trans "part" %}',
 | 
			
		||||
        plural_name: '{% trans "parts" %}',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    var columns = [
 | 
			
		||||
 
 | 
			
		||||
@@ -1724,7 +1724,9 @@ function loadStockTable(table, options) {
 | 
			
		||||
        labels: {
 | 
			
		||||
            url: '{% url "api-stockitem-label-list" %}',
 | 
			
		||||
            key: 'item',
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        singular_name: '{% trans "stock item" %}',
 | 
			
		||||
        plural_name: '{% trans "stock items" %}'
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Override the default values, or add new ones
 | 
			
		||||
@@ -2378,7 +2380,9 @@ function loadStockLocationTable(table, options) {
 | 
			
		||||
        labels: {
 | 
			
		||||
            url: '{% url "api-stocklocation-label-list" %}',
 | 
			
		||||
            key: 'location'
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        singular_name: '{% trans "stock location" %}',
 | 
			
		||||
        plural_name: '{% trans "stock locations" %}',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    for (var key in params) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user