mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Merge remote-tracking branch 'inventree/master' into pricing-form-updates
This commit is contained in:
		@@ -2,11 +2,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# InvenTree API version
 | 
					# InvenTree API version
 | 
				
			||||||
INVENTREE_API_VERSION = 96
 | 
					INVENTREE_API_VERSION = 97
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
 | 
					Increment this API version number whenever there is a significant change to the API that any clients need to know about
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					v97 -> 2023-02-20 : https://github.com/inventree/InvenTree/pull/4377
 | 
				
			||||||
 | 
					    - Adds "external" attribute to StockLocation model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
v96 -> 2023-02-16 : https://github.com/inventree/InvenTree/pull/4345
 | 
					v96 -> 2023-02-16 : https://github.com/inventree/InvenTree/pull/4345
 | 
				
			||||||
    - Adds stocktake report generation functionality
 | 
					    - Adds stocktake report generation functionality
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,6 +46,7 @@ import InvenTree.ready
 | 
				
			|||||||
import InvenTree.tasks
 | 
					import InvenTree.tasks
 | 
				
			||||||
import InvenTree.validators
 | 
					import InvenTree.validators
 | 
				
			||||||
import order.validators
 | 
					import order.validators
 | 
				
			||||||
 | 
					from plugin import registry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logger = logging.getLogger('inventree')
 | 
					logger = logging.getLogger('inventree')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1628,6 +1629,15 @@ class InvenTreeSetting(BaseInvenTreeSetting):
 | 
				
			|||||||
            return False
 | 
					            return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def label_printer_options():
 | 
				
			||||||
 | 
					    """Build a list of available label printer options."""
 | 
				
			||||||
 | 
					    printers = [('', _('No Printer (Export to PDF)'))]
 | 
				
			||||||
 | 
					    label_printer_plugins = registry.with_mixin('labels')
 | 
				
			||||||
 | 
					    if label_printer_plugins:
 | 
				
			||||||
 | 
					        printers.extend([(p.slug, p.name + ' - ' + p.human_name) for p in label_printer_plugins])
 | 
				
			||||||
 | 
					    return printers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class InvenTreeUserSetting(BaseInvenTreeSetting):
 | 
					class InvenTreeUserSetting(BaseInvenTreeSetting):
 | 
				
			||||||
    """An InvenTreeSetting object with a usercontext."""
 | 
					    """An InvenTreeSetting object with a usercontext."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1781,6 +1791,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
 | 
				
			|||||||
            'validator': bool,
 | 
					            'validator': bool,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        "LABEL_DEFAULT_PRINTER": {
 | 
				
			||||||
 | 
					            'name': _('Default label printer'),
 | 
				
			||||||
 | 
					            'description': _('Configure which label printer should be selected by default'),
 | 
				
			||||||
 | 
					            'default': '',
 | 
				
			||||||
 | 
					            'choices': label_printer_options
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        "REPORT_INLINE": {
 | 
					        "REPORT_INLINE": {
 | 
				
			||||||
            'name': _('Inline report display'),
 | 
					            'name': _('Inline report display'),
 | 
				
			||||||
            'description': _('Display PDF reports in the browser, instead of downloading as a file'),
 | 
					            'description': _('Display PDF reports in the browser, instead of downloading as a file'),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -299,27 +299,12 @@ loadSupplierPriceBreakTable({
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$('#new-price-break').click(function() {
 | 
					$('#new-price-break').click(function() {
 | 
				
			||||||
 | 
					    createSupplierPartPriceBreak({{ part.pk }}, {
 | 
				
			||||||
    constructForm(
 | 
					        onSuccess: function() {
 | 
				
			||||||
        '{% url "api-part-supplier-price-list" %}',
 | 
					            $("#price-break-table").bootstrapTable("refresh");
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            method: 'POST',
 | 
					 | 
				
			||||||
            fields: {
 | 
					 | 
				
			||||||
                quantity: {},
 | 
					 | 
				
			||||||
                part: {
 | 
					 | 
				
			||||||
                    value: {{ part.pk }},
 | 
					 | 
				
			||||||
                    hidden: true,
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                price: {},
 | 
					 | 
				
			||||||
                price_currency: {
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            title: '{% trans "Add Price Break" %}',
 | 
					 | 
				
			||||||
            onSuccess: function() {
 | 
					 | 
				
			||||||
                $("#price-break-table").bootstrapTable("refresh");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    );
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loadPurchaseOrderTable($("#purchase-order-table"), {
 | 
					loadPurchaseOrderTable($("#purchase-order-table"), {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -206,28 +206,7 @@ src="{% static 'img/blank_image.png' %}"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
$("#edit-order").click(function() {
 | 
					$("#edit-order").click(function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructForm('{% url "api-so-detail" order.pk %}', {
 | 
					    editSalesOrder({{ order.pk }}, {
 | 
				
			||||||
        fields: {
 | 
					 | 
				
			||||||
            reference: {
 | 
					 | 
				
			||||||
                icon: 'fa-hashtag',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            {% if order.lines.count == 0 and order.status == SalesOrderStatus.PENDING %}
 | 
					 | 
				
			||||||
            customer: {
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            {% endif %}
 | 
					 | 
				
			||||||
            customer_reference: {},
 | 
					 | 
				
			||||||
            description: {},
 | 
					 | 
				
			||||||
            target_date: {
 | 
					 | 
				
			||||||
                icon: 'fa-calendar-alt',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            link: {
 | 
					 | 
				
			||||||
                icon: 'fa-link',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            responsible: {
 | 
					 | 
				
			||||||
                icon: 'fa-user',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        title: '{% trans "Edit Sales Order" %}',
 | 
					 | 
				
			||||||
        reload: true,
 | 
					        reload: true,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -793,17 +793,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            constructForm('{% url "api-part-test-template-list" %}', {
 | 
					            constructForm('{% url "api-part-test-template-list" %}', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                fields: {
 | 
					                fields: partTestTemplateFields({
 | 
				
			||||||
                    test_name: {},
 | 
					                    part: {{ part.pk }}
 | 
				
			||||||
                    description: {},
 | 
					                }),
 | 
				
			||||||
                    required: {},
 | 
					 | 
				
			||||||
                    requires_value: {},
 | 
					 | 
				
			||||||
                    requires_attachment: {},
 | 
					 | 
				
			||||||
                    part: {
 | 
					 | 
				
			||||||
                        value: {{ part.pk }},
 | 
					 | 
				
			||||||
                        hidden: true,
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                title: '{% trans "Add Test Result Template" %}',
 | 
					                title: '{% trans "Add Test Result Template" %}',
 | 
				
			||||||
                onSuccess: function() {
 | 
					                onSuccess: function() {
 | 
				
			||||||
                    $("#test-template-table").bootstrapTable("refresh");
 | 
					                    $("#test-template-table").bootstrapTable("refresh");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -310,7 +310,8 @@ class StockLocationList(APIDownloadMixin, ListCreateAPI):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    filterset_fields = [
 | 
					    filterset_fields = [
 | 
				
			||||||
        'name',
 | 
					        'name',
 | 
				
			||||||
        'structural'
 | 
					        'structural',
 | 
				
			||||||
 | 
					        'external',
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    search_fields = [
 | 
					    search_fields = [
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								InvenTree/stock/migrations/0095_stocklocation_external.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								InvenTree/stock/migrations/0095_stocklocation_external.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					# Generated by Django 3.2.18 on 2023-02-20 12:22
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from django.db import migrations, models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Migration(migrations.Migration):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dependencies = [
 | 
				
			||||||
 | 
					        ('stock', '0094_auto_20230220_0025'),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    operations = [
 | 
				
			||||||
 | 
					        migrations.AddField(
 | 
				
			||||||
 | 
					            model_name='stocklocation',
 | 
				
			||||||
 | 
					            name='external',
 | 
				
			||||||
 | 
					            field=models.BooleanField(default=False, help_text='This is an external stock location', verbose_name='External'),
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
@@ -122,6 +122,12 @@ class StockLocation(InvenTreeBarcodeMixin, MetadataMixin, InvenTreeTree):
 | 
				
			|||||||
            'but may be located to child locations.'),
 | 
					            'but may be located to child locations.'),
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    external = models.BooleanField(
 | 
				
			||||||
 | 
					        default=False,
 | 
				
			||||||
 | 
					        verbose_name=_('External'),
 | 
				
			||||||
 | 
					        help_text=_('This is an external stock location')
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_location_owner(self):
 | 
					    def get_location_owner(self):
 | 
				
			||||||
        """Get the closest "owner" for this location.
 | 
					        """Get the closest "owner" for this location.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -584,6 +584,7 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
 | 
				
			|||||||
            'owner',
 | 
					            'owner',
 | 
				
			||||||
            'icon',
 | 
					            'icon',
 | 
				
			||||||
            'structural',
 | 
					            'structural',
 | 
				
			||||||
 | 
					            'external',
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        read_only_fields = [
 | 
					        read_only_fields = [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -313,17 +313,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        constructForm('{% url "api-stock-test-result-list" %}', {
 | 
					        constructForm('{% url "api-stock-test-result-list" %}', {
 | 
				
			||||||
            method: 'POST',
 | 
					            method: 'POST',
 | 
				
			||||||
            fields: {
 | 
					            fields: stockItemTestResultFields({
 | 
				
			||||||
                test: {},
 | 
					                stock_item: {{ item.pk }},
 | 
				
			||||||
                result: {},
 | 
					            }),
 | 
				
			||||||
                value: {},
 | 
					 | 
				
			||||||
                attachment: {},
 | 
					 | 
				
			||||||
                notes: {},
 | 
					 | 
				
			||||||
                stock_item: {
 | 
					 | 
				
			||||||
                    value: {{ item.pk }},
 | 
					 | 
				
			||||||
                    hidden: true,
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            title: '{% trans "Add Test Result" %}',
 | 
					            title: '{% trans "Add Test Result" %}',
 | 
				
			||||||
            onSuccess: reloadTable,
 | 
					            onSuccess: reloadTable,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -640,7 +640,9 @@ $("#stock-return-from-customer").click(function() {
 | 
				
			|||||||
                value: {{ item.part.default_location.pk }},
 | 
					                value: {{ item.part.default_location.pk }},
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            notes: {},
 | 
					            notes: {
 | 
				
			||||||
 | 
					                icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        method: 'POST',
 | 
					        method: 'POST',
 | 
				
			||||||
        title: '{% trans "Return to Stock" %}',
 | 
					        title: '{% trans "Return to Stock" %}',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@
 | 
				
			|||||||
    <table class='table table-striped table-condensed'>
 | 
					    <table class='table table-striped table-condensed'>
 | 
				
			||||||
        <tbody>
 | 
					        <tbody>
 | 
				
			||||||
            {% include "InvenTree/settings/setting.html" with key="LABEL_INLINE" icon='fa-tag' user_setting=True %}
 | 
					            {% include "InvenTree/settings/setting.html" with key="LABEL_INLINE" icon='fa-tag' user_setting=True %}
 | 
				
			||||||
 | 
					            {% include "InvenTree/settings/setting.html" with key="LABEL_DEFAULT_PRINTER" icon='fa-tag' user_setting=True %}
 | 
				
			||||||
        </tbody>
 | 
					        </tbody>
 | 
				
			||||||
    </table>
 | 
					    </table>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,9 @@ function addAttachmentButtonCallbacks(url, fields={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        var file_fields = {
 | 
					        var file_fields = {
 | 
				
			||||||
            attachment: {},
 | 
					            attachment: {},
 | 
				
			||||||
            comment: {},
 | 
					            comment: {
 | 
				
			||||||
 | 
					                icon: 'fa-comment',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Object.assign(file_fields, fields);
 | 
					        Object.assign(file_fields, fields);
 | 
				
			||||||
@@ -42,8 +44,12 @@ function addAttachmentButtonCallbacks(url, fields={}) {
 | 
				
			|||||||
    $('#new-attachment-link').click(function() {
 | 
					    $('#new-attachment-link').click(function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var link_fields = {
 | 
					        var link_fields = {
 | 
				
			||||||
            link: {},
 | 
					            link: {
 | 
				
			||||||
            comment: {},
 | 
					                icon: 'fa-link',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            comment: {
 | 
				
			||||||
 | 
					                icon: 'fa-comment',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Object.assign(link_fields, fields);
 | 
					        Object.assign(link_fields, fields);
 | 
				
			||||||
@@ -252,8 +258,12 @@ function loadAttachmentTable(url, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    constructForm(`${url}${pk}/`, {
 | 
					                    constructForm(`${url}${pk}/`, {
 | 
				
			||||||
                        fields: {
 | 
					                        fields: {
 | 
				
			||||||
                            link: {},
 | 
					                            link: {
 | 
				
			||||||
                            comment: {},
 | 
					                                icon: 'fa-link',
 | 
				
			||||||
 | 
					                            },
 | 
				
			||||||
 | 
					                            comment: {
 | 
				
			||||||
 | 
					                                icon: 'fa-comment',
 | 
				
			||||||
 | 
					                            },
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                        processResults: function(data, fields, opts) {
 | 
					                        processResults: function(data, fields, opts) {
 | 
				
			||||||
                            // Remove the "link" field if the attachment is a file!
 | 
					                            // Remove the "link" field if the attachment is a file!
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -408,6 +408,7 @@ function bomItemFields() {
 | 
				
			|||||||
            hidden: true,
 | 
					            hidden: true,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        sub_part: {
 | 
					        sub_part: {
 | 
				
			||||||
 | 
					            icon: 'fa-shapes',
 | 
				
			||||||
            secondary: {
 | 
					            secondary: {
 | 
				
			||||||
                title: '{% trans "New Part" %}',
 | 
					                title: '{% trans "New Part" %}',
 | 
				
			||||||
                fields: function() {
 | 
					                fields: function() {
 | 
				
			||||||
@@ -424,7 +425,9 @@ function bomItemFields() {
 | 
				
			|||||||
        quantity: {},
 | 
					        quantity: {},
 | 
				
			||||||
        reference: {},
 | 
					        reference: {},
 | 
				
			||||||
        overage: {},
 | 
					        overage: {},
 | 
				
			||||||
        note: {},
 | 
					        note: {
 | 
				
			||||||
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        allow_variants: {},
 | 
					        allow_variants: {},
 | 
				
			||||||
        inherited: {},
 | 
					        inherited: {},
 | 
				
			||||||
        consumable: {},
 | 
					        consumable: {},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -536,7 +536,9 @@ function completeBuildOutputs(build_id, outputs, options={}) {
 | 
				
			|||||||
                    structural: false,
 | 
					                    structural: false,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            notes: {},
 | 
					            notes: {
 | 
				
			||||||
 | 
					                icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            accept_incomplete_allocation: {},
 | 
					            accept_incomplete_allocation: {},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        confirm: true,
 | 
					        confirm: true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,11 +13,13 @@
 | 
				
			|||||||
    createCompany,
 | 
					    createCompany,
 | 
				
			||||||
    createManufacturerPart,
 | 
					    createManufacturerPart,
 | 
				
			||||||
    createSupplierPart,
 | 
					    createSupplierPart,
 | 
				
			||||||
 | 
					    createSupplierPartPriceBreak,
 | 
				
			||||||
    deleteManufacturerParts,
 | 
					    deleteManufacturerParts,
 | 
				
			||||||
    deleteManufacturerPartParameters,
 | 
					    deleteManufacturerPartParameters,
 | 
				
			||||||
    deleteSupplierParts,
 | 
					    deleteSupplierParts,
 | 
				
			||||||
    duplicateSupplierPart,
 | 
					    duplicateSupplierPart,
 | 
				
			||||||
    editCompany,
 | 
					    editCompany,
 | 
				
			||||||
 | 
					    editSupplierPartPriceBreak,
 | 
				
			||||||
    loadCompanyTable,
 | 
					    loadCompanyTable,
 | 
				
			||||||
    loadManufacturerPartTable,
 | 
					    loadManufacturerPartTable,
 | 
				
			||||||
    loadManufacturerPartParameterTable,
 | 
					    loadManufacturerPartParameterTable,
 | 
				
			||||||
@@ -128,7 +130,7 @@ function supplierPartFields(options={}) {
 | 
				
			|||||||
            icon: 'fa-link',
 | 
					            icon: 'fa-link',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        note: {
 | 
					        note: {
 | 
				
			||||||
            icon: 'fa-pencil-alt',
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        packaging: {
 | 
					        packaging: {
 | 
				
			||||||
            icon: 'fa-box',
 | 
					            icon: 'fa-box',
 | 
				
			||||||
@@ -321,6 +323,43 @@ function deleteSupplierParts(parts, options={}) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Construct set of fields for SupplierPartPriceBreak form */
 | 
				
			||||||
 | 
					function supplierPartPriceBreakFields(options={}) {
 | 
				
			||||||
 | 
					    let fields = {
 | 
				
			||||||
 | 
					        part: {
 | 
				
			||||||
 | 
					            hidden: true,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        quantity: {},
 | 
				
			||||||
 | 
					        price: {
 | 
				
			||||||
 | 
					            icon: 'fa-dollar-sign',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        price_currency: {
 | 
				
			||||||
 | 
					            icon: 'fa-coins',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return fields;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Create a new SupplierPartPriceBreak instance */
 | 
				
			||||||
 | 
					function createSupplierPartPriceBreak(part_id, options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let fields = supplierPartPriceBreakFields(options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fields.part.value = part_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    constructForm('{% url "api-part-supplier-price-list" %}', {
 | 
				
			||||||
 | 
					        fields: fields,
 | 
				
			||||||
 | 
					        method: 'POST',
 | 
				
			||||||
 | 
					        fields: fields,
 | 
				
			||||||
 | 
					        title: '{% trans "Add Price Break" %}',
 | 
				
			||||||
 | 
					        onSuccess: function(response) {
 | 
				
			||||||
 | 
					            handleFormSuccess(response, options);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns a default form-set for creating / editing a Company object
 | 
					// Returns a default form-set for creating / editing a Company object
 | 
				
			||||||
function companyFormFields() {
 | 
					function companyFormFields() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1125,11 +1164,7 @@ function loadSupplierPriceBreakTable(options={}) {
 | 
				
			|||||||
            var pk = $(this).attr('pk');
 | 
					            var pk = $(this).attr('pk');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            constructForm(`/api/company/price-break/${pk}/`, {
 | 
					            constructForm(`/api/company/price-break/${pk}/`, {
 | 
				
			||||||
                fields: {
 | 
					                fields: supplierPartPriceBreakFields(),
 | 
				
			||||||
                    quantity: {},
 | 
					 | 
				
			||||||
                    price: {},
 | 
					 | 
				
			||||||
                    price_currency: {},
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                title: '{% trans "Edit Price Break" %}',
 | 
					                title: '{% trans "Edit Price Break" %}',
 | 
				
			||||||
                onSuccess: function() {
 | 
					                onSuccess: function() {
 | 
				
			||||||
                    table.bootstrapTable('refresh');
 | 
					                    table.bootstrapTable('refresh');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -262,7 +262,11 @@ function selectLabel(labels, items, options={}) {
 | 
				
			|||||||
        `;
 | 
					        `;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        plugins.forEach(function(plugin) {
 | 
					        plugins.forEach(function(plugin) {
 | 
				
			||||||
            plugin_selection += `<option value='${plugin.key}' title='${plugin.meta.human_name}'>${plugin.name} - <small>${plugin.meta.human_name}</small></option>`;
 | 
					            var selected = '';
 | 
				
			||||||
 | 
					            if (user_settings['LABEL_DEFAULT_PRINTER'] == plugin.key) {
 | 
				
			||||||
 | 
					                selected = ' selected';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            plugin_selection += `<option value='${plugin.key}' title='${plugin.meta.human_name}'${selected}>${plugin.name} - <small>${plugin.meta.human_name}</small></option>`;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        plugin_selection += `
 | 
					        plugin_selection += `
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,7 @@
 | 
				
			|||||||
    duplicatePurchaseOrder,
 | 
					    duplicatePurchaseOrder,
 | 
				
			||||||
    editPurchaseOrder,
 | 
					    editPurchaseOrder,
 | 
				
			||||||
    editPurchaseOrderLineItem,
 | 
					    editPurchaseOrderLineItem,
 | 
				
			||||||
 | 
					    editSalesOrder,
 | 
				
			||||||
    exportOrder,
 | 
					    exportOrder,
 | 
				
			||||||
    issuePurchaseOrder,
 | 
					    issuePurchaseOrder,
 | 
				
			||||||
    loadPurchaseOrderLineItemTable,
 | 
					    loadPurchaseOrderLineItemTable,
 | 
				
			||||||
@@ -55,6 +56,9 @@
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Form field definitions for a SalesOrderShipment
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function salesOrderShipmentFields(options={}) {
 | 
					function salesOrderShipmentFields(options={}) {
 | 
				
			||||||
    var fields = {
 | 
					    var fields = {
 | 
				
			||||||
        order: {},
 | 
					        order: {},
 | 
				
			||||||
@@ -520,42 +524,55 @@ function createSalesOrderShipment(options={}) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function salesOrderFields(options={}) {
 | 
				
			||||||
 | 
					    let fields = {
 | 
				
			||||||
 | 
					        reference: {
 | 
				
			||||||
 | 
					            icon: 'fa-hashtag',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        description: {},
 | 
				
			||||||
 | 
					        customer: {
 | 
				
			||||||
 | 
					            icon: 'fa-user-tie',
 | 
				
			||||||
 | 
					            secondary: {
 | 
				
			||||||
 | 
					                title: '{% trans "Add Customer" %}',
 | 
				
			||||||
 | 
					                fields: function() {
 | 
				
			||||||
 | 
					                    var fields = companyFormFields();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    fields.is_customer.value = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    return fields;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        customer_reference: {},
 | 
				
			||||||
 | 
					        target_date: {
 | 
				
			||||||
 | 
					            icon: 'fa-calendar-alt',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        link: {
 | 
				
			||||||
 | 
					            icon: 'fa-link',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        responsible: {
 | 
				
			||||||
 | 
					            icon: 'fa-user',
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return fields;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Create a new SalesOrder
 | 
					 * Create a new SalesOrder
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function createSalesOrder(options={}) {
 | 
					function createSalesOrder(options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let fields = salesOrderFields(options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (options.customer) {
 | 
				
			||||||
 | 
					        fields.customer.value = options.customer;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructForm('{% url "api-so-list" %}', {
 | 
					    constructForm('{% url "api-so-list" %}', {
 | 
				
			||||||
        method: 'POST',
 | 
					        method: 'POST',
 | 
				
			||||||
        fields: {
 | 
					        fields: fields,
 | 
				
			||||||
            reference: {
 | 
					 | 
				
			||||||
                icon: 'fa-hashtag',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            customer: {
 | 
					 | 
				
			||||||
                value: options.customer,
 | 
					 | 
				
			||||||
                secondary: {
 | 
					 | 
				
			||||||
                    title: '{% trans "Add Customer" %}',
 | 
					 | 
				
			||||||
                    fields: function() {
 | 
					 | 
				
			||||||
                        var fields = companyFormFields();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        fields.is_customer.value = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        return fields;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            customer_reference: {},
 | 
					 | 
				
			||||||
            description: {},
 | 
					 | 
				
			||||||
            target_date: {
 | 
					 | 
				
			||||||
                icon: 'fa-calendar-alt',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            link: {
 | 
					 | 
				
			||||||
                icon: 'fa-link',
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            responsible: {
 | 
					 | 
				
			||||||
                icon: 'fa-user',
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        onSuccess: function(data) {
 | 
					        onSuccess: function(data) {
 | 
				
			||||||
            location.href = `/order/sales-order/${data.pk}/`;
 | 
					            location.href = `/order/sales-order/${data.pk}/`;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@@ -564,12 +581,27 @@ function createSalesOrder(options={}) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Edit an existing SalesOrder
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function editSalesOrder(order_id, options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    constructForm(`/api/order/so/${order_id}/`, {
 | 
				
			||||||
 | 
					        fields: salesOrderFields(options),
 | 
				
			||||||
 | 
					        title: '{% trans "Edit Sales Order" %}',
 | 
				
			||||||
 | 
					        onSuccess: function(response) {
 | 
				
			||||||
 | 
					            handleFormSuccess(response, options);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Launch a modal form to create a new SalesOrderLineItem
 | 
					 * Launch a modal form to create a new SalesOrderLineItem
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function createSalesOrderLineItem(options={}) {
 | 
					function createSalesOrderLineItem(options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var fields = soLineItemFields(options);
 | 
					    let fields = soLineItemFields(options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructForm('{% url "api-so-line-list" %}', {
 | 
					    constructForm('{% url "api-so-line-list" %}', {
 | 
				
			||||||
        fields: fields,
 | 
					        fields: fields,
 | 
				
			||||||
@@ -591,6 +623,7 @@ function purchaseOrderFields(options={}) {
 | 
				
			|||||||
        reference: {
 | 
					        reference: {
 | 
				
			||||||
            icon: 'fa-hashtag',
 | 
					            icon: 'fa-hashtag',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        description: {},
 | 
				
			||||||
        supplier: {
 | 
					        supplier: {
 | 
				
			||||||
            icon: 'fa-building',
 | 
					            icon: 'fa-building',
 | 
				
			||||||
            secondary: {
 | 
					            secondary: {
 | 
				
			||||||
@@ -604,7 +637,6 @@ function purchaseOrderFields(options={}) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        description: {},
 | 
					 | 
				
			||||||
        supplier_reference: {},
 | 
					        supplier_reference: {},
 | 
				
			||||||
        target_date: {
 | 
					        target_date: {
 | 
				
			||||||
            icon: 'fa-calendar-alt',
 | 
					            icon: 'fa-calendar-alt',
 | 
				
			||||||
@@ -762,13 +794,23 @@ function soLineItemFields(options={}) {
 | 
				
			|||||||
        order: {
 | 
					        order: {
 | 
				
			||||||
            hidden: true,
 | 
					            hidden: true,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        part: {},
 | 
					        part: {
 | 
				
			||||||
 | 
					            icon: 'fa-shapes',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        quantity: {},
 | 
					        quantity: {},
 | 
				
			||||||
        reference: {},
 | 
					        reference: {},
 | 
				
			||||||
        sale_price: {},
 | 
					        sale_price: {
 | 
				
			||||||
        sale_price_currency: {},
 | 
					            icon: 'fa-dollar-sign',
 | 
				
			||||||
        target_date: {},
 | 
					        },
 | 
				
			||||||
        notes: {},
 | 
					        sale_price_currency: {
 | 
				
			||||||
 | 
					            icon: 'fa-coins',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        target_date: {
 | 
				
			||||||
 | 
					            icon: 'fa-calendar-alt',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        notes: {
 | 
				
			||||||
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.order) {
 | 
					    if (options.order) {
 | 
				
			||||||
@@ -792,9 +834,15 @@ function extraLineFields(options={}) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        quantity: {},
 | 
					        quantity: {},
 | 
				
			||||||
        reference: {},
 | 
					        reference: {},
 | 
				
			||||||
        price: {},
 | 
					        price: {
 | 
				
			||||||
        price_currency: {},
 | 
					            icon: 'fa-dollar-sign',
 | 
				
			||||||
        notes: {},
 | 
					        },
 | 
				
			||||||
 | 
					        price_currency: {
 | 
				
			||||||
 | 
					            icon: 'fa-coins',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        notes: {
 | 
				
			||||||
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.order) {
 | 
					    if (options.order) {
 | 
				
			||||||
@@ -815,6 +863,7 @@ function poLineItemFields(options={}) {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        part: {
 | 
					        part: {
 | 
				
			||||||
 | 
					            icon: 'fa-shapes',
 | 
				
			||||||
            filters: {
 | 
					            filters: {
 | 
				
			||||||
                part_detail: true,
 | 
					                part_detail: true,
 | 
				
			||||||
                supplier_detail: true,
 | 
					                supplier_detail: true,
 | 
				
			||||||
@@ -911,15 +960,24 @@ function poLineItemFields(options={}) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        quantity: {},
 | 
					        quantity: {},
 | 
				
			||||||
        reference: {},
 | 
					        reference: {},
 | 
				
			||||||
        purchase_price: {},
 | 
					        purchase_price: {
 | 
				
			||||||
        purchase_price_currency: {},
 | 
					            icon: 'fa-dollar-sign',
 | 
				
			||||||
        target_date: {},
 | 
					        },
 | 
				
			||||||
 | 
					        purchase_price_currency: {
 | 
				
			||||||
 | 
					            icon: 'fa-coins',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        target_date: {
 | 
				
			||||||
 | 
					            icon: 'fa-calendar-alt',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        destination: {
 | 
					        destination: {
 | 
				
			||||||
 | 
					            icon: 'fa-sitemap',
 | 
				
			||||||
            filters: {
 | 
					            filters: {
 | 
				
			||||||
                structural: false,
 | 
					                structural: false,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        notes: {},
 | 
					        notes: {
 | 
				
			||||||
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.order) {
 | 
					    if (options.order) {
 | 
				
			||||||
@@ -2655,13 +2713,7 @@ function loadPurchaseOrderExtraLineTable(table, options={}) {
 | 
				
			|||||||
            var pk = $(this).attr('pk');
 | 
					            var pk = $(this).attr('pk');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            constructForm(`/api/order/po-extra-line/${pk}/`, {
 | 
					            constructForm(`/api/order/po-extra-line/${pk}/`, {
 | 
				
			||||||
                fields: {
 | 
					                fields: extraLineFields(),
 | 
				
			||||||
                    quantity: {},
 | 
					 | 
				
			||||||
                    reference: {},
 | 
					 | 
				
			||||||
                    price: {},
 | 
					 | 
				
			||||||
                    price_currency: {},
 | 
					 | 
				
			||||||
                    notes: {},
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                title: '{% trans "Edit Line" %}',
 | 
					                title: '{% trans "Edit Line" %}',
 | 
				
			||||||
                onSuccess: reloadTable,
 | 
					                onSuccess: reloadTable,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -4100,7 +4152,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
 | 
				
			|||||||
            inventreeGet(`/api/order/so-line/${pk}/`, {}, {
 | 
					            inventreeGet(`/api/order/so-line/${pk}/`, {}, {
 | 
				
			||||||
                success: function(data) {
 | 
					                success: function(data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var fields = soLineItemFields();
 | 
					                    let fields = soLineItemFields();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    constructForm('{% url "api-so-line-list" %}', {
 | 
					                    constructForm('{% url "api-so-line-list" %}', {
 | 
				
			||||||
                        method: 'POST',
 | 
					                        method: 'POST',
 | 
				
			||||||
@@ -4120,14 +4172,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
 | 
				
			|||||||
            var pk = $(this).attr('pk');
 | 
					            var pk = $(this).attr('pk');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            constructForm(`/api/order/so-line/${pk}/`, {
 | 
					            constructForm(`/api/order/so-line/${pk}/`, {
 | 
				
			||||||
                fields: {
 | 
					                fields: soLineItemFields(),
 | 
				
			||||||
                    quantity: {},
 | 
					 | 
				
			||||||
                    reference: {},
 | 
					 | 
				
			||||||
                    sale_price: {},
 | 
					 | 
				
			||||||
                    sale_price_currency: {},
 | 
					 | 
				
			||||||
                    target_date: {},
 | 
					 | 
				
			||||||
                    notes: {},
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                title: '{% trans "Edit Line Item" %}',
 | 
					                title: '{% trans "Edit Line Item" %}',
 | 
				
			||||||
                onSuccess: reloadTable,
 | 
					                onSuccess: reloadTable,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -4438,13 +4483,7 @@ function loadSalesOrderExtraLineTable(table, options={}) {
 | 
				
			|||||||
            var pk = $(this).attr('pk');
 | 
					            var pk = $(this).attr('pk');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            constructForm(`/api/order/so-extra-line/${pk}/`, {
 | 
					            constructForm(`/api/order/so-extra-line/${pk}/`, {
 | 
				
			||||||
                fields: {
 | 
					                fields: extraLineFields(),
 | 
				
			||||||
                    quantity: {},
 | 
					 | 
				
			||||||
                    reference: {},
 | 
					 | 
				
			||||||
                    price: {},
 | 
					 | 
				
			||||||
                    price_currency: {},
 | 
					 | 
				
			||||||
                    notes: {},
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                title: '{% trans "Edit Line" %}',
 | 
					                title: '{% trans "Edit Line" %}',
 | 
				
			||||||
                onSuccess: reloadTable,
 | 
					                onSuccess: reloadTable,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,7 @@
 | 
				
			|||||||
    loadSimplePartTable,
 | 
					    loadSimplePartTable,
 | 
				
			||||||
    partDetail,
 | 
					    partDetail,
 | 
				
			||||||
    partStockLabel,
 | 
					    partStockLabel,
 | 
				
			||||||
 | 
					    partTestTemplateFields,
 | 
				
			||||||
    toggleStar,
 | 
					    toggleStar,
 | 
				
			||||||
    validateBom,
 | 
					    validateBom,
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
@@ -108,11 +109,13 @@ function partFields(options={}) {
 | 
				
			|||||||
            icon: 'fa-link',
 | 
					            icon: 'fa-link',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        default_location: {
 | 
					        default_location: {
 | 
				
			||||||
 | 
					            icon: 'fa-sitemap',
 | 
				
			||||||
            filters: {
 | 
					            filters: {
 | 
				
			||||||
                structural: false,
 | 
					                structural: false,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        default_supplier: {
 | 
					        default_supplier: {
 | 
				
			||||||
 | 
					            icon: 'fa-building',
 | 
				
			||||||
            filters: {
 | 
					            filters: {
 | 
				
			||||||
                part_detail: true,
 | 
					                part_detail: true,
 | 
				
			||||||
                supplier_detail: true,
 | 
					                supplier_detail: true,
 | 
				
			||||||
@@ -253,6 +256,7 @@ function categoryFields() {
 | 
				
			|||||||
        name: {},
 | 
					        name: {},
 | 
				
			||||||
        description: {},
 | 
					        description: {},
 | 
				
			||||||
        default_location: {
 | 
					        default_location: {
 | 
				
			||||||
 | 
					            icon: 'fa-sitemap',
 | 
				
			||||||
            filters: {
 | 
					            filters: {
 | 
				
			||||||
                structural: false,
 | 
					                structural: false,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -978,11 +982,21 @@ function loadPartStocktakeTable(partId, options={}) {
 | 
				
			|||||||
                    fields: {
 | 
					                    fields: {
 | 
				
			||||||
                        item_count: {},
 | 
					                        item_count: {},
 | 
				
			||||||
                        quantity: {},
 | 
					                        quantity: {},
 | 
				
			||||||
                        cost_min: {},
 | 
					                        cost_min: {
 | 
				
			||||||
                        cost_min_currency: {},
 | 
					                            icon: 'fa-dollar-sign',
 | 
				
			||||||
                        cost_max: {},
 | 
					                        },
 | 
				
			||||||
                        cost_max_currency: {},
 | 
					                        cost_min_currency: {
 | 
				
			||||||
                        note: {},
 | 
					                            icon: 'fa-coins',
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                        cost_max: {
 | 
				
			||||||
 | 
					                            icon: 'fa-dollar-sign',
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                        cost_max_currency: {
 | 
				
			||||||
 | 
					                            icon: 'fa-coins',
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                        note: {
 | 
				
			||||||
 | 
					                            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    title: '{% trans "Edit Stocktake Entry" %}',
 | 
					                    title: '{% trans "Edit Stocktake Entry" %}',
 | 
				
			||||||
                    onSuccess: function() {
 | 
					                    onSuccess: function() {
 | 
				
			||||||
@@ -2403,10 +2417,32 @@ function loadPartCategoryTable(table, options) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Construct a set of fields for the PartTestTemplate model form */
 | 
				
			||||||
 | 
					function partTestTemplateFields(options={}) {
 | 
				
			||||||
 | 
					    let fields = {
 | 
				
			||||||
 | 
					        test_name: {},
 | 
				
			||||||
 | 
					        description: {},
 | 
				
			||||||
 | 
					        required: {},
 | 
				
			||||||
 | 
					        requires_value: {},
 | 
				
			||||||
 | 
					        requires_attachment: {},
 | 
				
			||||||
 | 
					        part: {
 | 
				
			||||||
 | 
					            hidden: true,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (options.part) {
 | 
				
			||||||
 | 
					        fields.part.value = options.part;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return fields;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Load PartTestTemplate table.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function loadPartTestTemplateTable(table, options) {
 | 
					function loadPartTestTemplateTable(table, options) {
 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
     * Load PartTestTemplate table.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2505,13 +2541,7 @@ function loadPartTestTemplateTable(table, options) {
 | 
				
			|||||||
                var url = `/api/part/test-template/${pk}/`;
 | 
					                var url = `/api/part/test-template/${pk}/`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                constructForm(url, {
 | 
					                constructForm(url, {
 | 
				
			||||||
                    fields: {
 | 
					                    fields: partTestTemplateFields(),
 | 
				
			||||||
                        test_name: {},
 | 
					 | 
				
			||||||
                        description: {},
 | 
					 | 
				
			||||||
                        required: {},
 | 
					 | 
				
			||||||
                        requires_value: {},
 | 
					 | 
				
			||||||
                        requires_attachment: {},
 | 
					 | 
				
			||||||
                    },
 | 
					 | 
				
			||||||
                    title: '{% trans "Edit Test Result Template" %}',
 | 
					                    title: '{% trans "Edit Test Result Template" %}',
 | 
				
			||||||
                    onSuccess: function() {
 | 
					                    onSuccess: function() {
 | 
				
			||||||
                        table.bootstrapTable('refresh');
 | 
					                        table.bootstrapTable('refresh');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -652,8 +652,12 @@ function initPriceBreakSet(table, options) {
 | 
				
			|||||||
                    value: part_id,
 | 
					                    value: part_id,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                quantity: {},
 | 
					                quantity: {},
 | 
				
			||||||
                price: {},
 | 
					                price: {
 | 
				
			||||||
                price_currency: {},
 | 
					                    icon: 'fa-dollar-sign',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                price_currency: {
 | 
				
			||||||
 | 
					                    icon: 'fa-coins',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            method: 'POST',
 | 
					            method: 'POST',
 | 
				
			||||||
            title: '{% trans "Add Price Break" %}',
 | 
					            title: '{% trans "Add Price Break" %}',
 | 
				
			||||||
@@ -677,8 +681,12 @@ function initPriceBreakSet(table, options) {
 | 
				
			|||||||
        constructForm(`${pb_url}${pk}/`, {
 | 
					        constructForm(`${pb_url}${pk}/`, {
 | 
				
			||||||
            fields: {
 | 
					            fields: {
 | 
				
			||||||
                quantity: {},
 | 
					                quantity: {},
 | 
				
			||||||
                price: {},
 | 
					                price: {
 | 
				
			||||||
                price_currency: {},
 | 
					                    icon: 'fa-dollar-sign',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                price_currency: {
 | 
				
			||||||
 | 
					                    icon: 'fa-coins',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            title: '{% trans "Edit Price Break" %}',
 | 
					            title: '{% trans "Edit Price Break" %}',
 | 
				
			||||||
            onSuccess: reloadPriceBreakTable,
 | 
					            onSuccess: reloadPriceBreakTable,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -117,6 +117,7 @@ function stockLocationFields(options={}) {
 | 
				
			|||||||
        description: {},
 | 
					        description: {},
 | 
				
			||||||
        owner: {},
 | 
					        owner: {},
 | 
				
			||||||
        structural: {},
 | 
					        structural: {},
 | 
				
			||||||
 | 
					        external: {},
 | 
				
			||||||
        icon: {
 | 
					        icon: {
 | 
				
			||||||
            help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
 | 
					            help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
 | 
				
			||||||
            placeholder: 'fas fa-box',
 | 
					            placeholder: 'fas fa-box',
 | 
				
			||||||
@@ -310,18 +311,24 @@ function stockItemFields(options={}) {
 | 
				
			|||||||
            icon: 'fa-layer-group',
 | 
					            icon: 'fa-layer-group',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        status: {},
 | 
					        status: {},
 | 
				
			||||||
        expiry_date: {},
 | 
					        expiry_date: {
 | 
				
			||||||
 | 
					            icon: 'fa-calendar-alt',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        purchase_price: {
 | 
					        purchase_price: {
 | 
				
			||||||
            icon: 'fa-dollar-sign',
 | 
					            icon: 'fa-dollar-sign',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        purchase_price_currency: {},
 | 
					        purchase_price_currency: {
 | 
				
			||||||
 | 
					            icon: 'fa-coins',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        packaging: {
 | 
					        packaging: {
 | 
				
			||||||
            icon: 'fa-box',
 | 
					            icon: 'fa-box',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        link: {
 | 
					        link: {
 | 
				
			||||||
            icon: 'fa-link',
 | 
					            icon: 'fa-link',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        owner: {},
 | 
					        owner: {
 | 
				
			||||||
 | 
					            icon: 'fa-user',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        delete_on_deplete: {},
 | 
					        delete_on_deplete: {},
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -685,7 +692,9 @@ function assignStockToCustomer(items, options={}) {
 | 
				
			|||||||
                    is_customer: true,
 | 
					                    is_customer: true,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            notes: {},
 | 
					            notes: {
 | 
				
			||||||
 | 
					                icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        confirm: true,
 | 
					        confirm: true,
 | 
				
			||||||
        confirmMessage: '{% trans "Confirm stock assignment" %}',
 | 
					        confirmMessage: '{% trans "Confirm stock assignment" %}',
 | 
				
			||||||
@@ -854,7 +863,9 @@ function mergeStockItems(items, options={}) {
 | 
				
			|||||||
                    structural: false,
 | 
					                    structural: false,
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            notes: {},
 | 
					            notes: {
 | 
				
			||||||
 | 
					                icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            allow_mismatched_suppliers: {},
 | 
					            allow_mismatched_suppliers: {},
 | 
				
			||||||
            allow_mismatched_status: {},
 | 
					            allow_mismatched_status: {},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@@ -1298,6 +1309,28 @@ function formatDate(row) {
 | 
				
			|||||||
    return html;
 | 
					    return html;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Construct set of default fields for a StockItemTestResult */
 | 
				
			||||||
 | 
					function stockItemTestResultFields(options={}) {
 | 
				
			||||||
 | 
					    let fields = {
 | 
				
			||||||
 | 
					        test: {},
 | 
				
			||||||
 | 
					        result: {},
 | 
				
			||||||
 | 
					        value: {},
 | 
				
			||||||
 | 
					        attachment: {},
 | 
				
			||||||
 | 
					        notes: {
 | 
				
			||||||
 | 
					            icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        stock_item: {
 | 
				
			||||||
 | 
					            hidden: true,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (options.stock_item) {
 | 
				
			||||||
 | 
					        fields.stock_item.value = options.stock_item;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return fields;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Load StockItemTestResult table
 | 
					 * Load StockItemTestResult table
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -1563,7 +1596,9 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
                result: {},
 | 
					                result: {},
 | 
				
			||||||
                value: {},
 | 
					                value: {},
 | 
				
			||||||
                attachment: {},
 | 
					                attachment: {},
 | 
				
			||||||
                notes: {},
 | 
					                notes: {
 | 
				
			||||||
 | 
					                    icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
                stock_item: {
 | 
					                stock_item: {
 | 
				
			||||||
                    value: options.stock_item,
 | 
					                    value: options.stock_item,
 | 
				
			||||||
                    hidden: true,
 | 
					                    hidden: true,
 | 
				
			||||||
@@ -1583,13 +1618,7 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
        var url = `/api/stock/test/${pk}/`;
 | 
					        var url = `/api/stock/test/${pk}/`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        constructForm(url, {
 | 
					        constructForm(url, {
 | 
				
			||||||
            fields: {
 | 
					            fields: stockItemTestResultFields(),
 | 
				
			||||||
                test: {},
 | 
					 | 
				
			||||||
                result: {},
 | 
					 | 
				
			||||||
                value: {},
 | 
					 | 
				
			||||||
                attachment: {},
 | 
					 | 
				
			||||||
                notes: {},
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            title: '{% trans "Edit Test Result" %}',
 | 
					            title: '{% trans "Edit Test Result" %}',
 | 
				
			||||||
            onSuccess: reloadTestTable,
 | 
					            onSuccess: reloadTestTable,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -2491,6 +2520,24 @@ function loadStockLocationTable(table, options) {
 | 
				
			|||||||
                title: '{% trans "Stock Items" %}',
 | 
					                title: '{% trans "Stock Items" %}',
 | 
				
			||||||
                switchable: true,
 | 
					                switchable: true,
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                field: 'structural',
 | 
				
			||||||
 | 
					                title: '{% trans "Structural" %}',
 | 
				
			||||||
 | 
					                switchable: true,
 | 
				
			||||||
 | 
					                sortable: false,
 | 
				
			||||||
 | 
					                formatter: function(value) {
 | 
				
			||||||
 | 
					                    return yesNoLabel(value);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                field: 'external',
 | 
				
			||||||
 | 
					                title: '{% trans "External" %}',
 | 
				
			||||||
 | 
					                switchable: true,
 | 
				
			||||||
 | 
					                sortable: false,
 | 
				
			||||||
 | 
					                formatter: function(value) {
 | 
				
			||||||
 | 
					                    return yesNoLabel(value);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
@@ -2841,7 +2888,9 @@ function uninstallStockItem(installed_item_id, options={}) {
 | 
				
			|||||||
                        structural: false,
 | 
					                        structural: false,
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                note: {},
 | 
					                note: {
 | 
				
			||||||
 | 
					                    icon: 'fa-sticky-note',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            preFormContent: function(opts) {
 | 
					            preFormContent: function(opts) {
 | 
				
			||||||
                var html = '';
 | 
					                var html = '';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -134,6 +134,10 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Structural" %}',
 | 
					                title: '{% trans "Structural" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 | 
					            external: {
 | 
				
			||||||
 | 
					                type: 'bool',
 | 
				
			||||||
 | 
					                title: '{% trans "External" %}',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user