diff --git a/CHANGELOG.md b/CHANGELOG.md
index 32774e2965..c1c81a1fa4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,9 +26,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#13274](https://github.com/inventree/InvenTree/pull/13274) API requests which modify an existing object (updates, and "action" endpoints such as issuing or completing an order) now lock the database row before reading it, and run within a single database transaction. This prevents a concurrent edit from silently overwriting changes made by a background task (e.g. the "completed" quantity of a build order being reset while its outputs were being completed). If the object is locked by another long-running process, the request now returns a `409 Conflict` response and can be retried. A failed action no longer leaves partial changes behind.
- [#13241](https://github.com/inventree/InvenTree/pull/13241) completing a password reset now verifies the user's email address (when the account has a single address matching the account email), allowing users created by an administrator to set up MFA while it is enforced.
+- [#13369](https://github.com/inventree/InvenTree/pull/13369) The `STOCK_ALLOW_EXPIRED_BUILD` and `STOCK_ALLOW_EXPIRED_SALE` settings are enforced again (they had no effect since the legacy user interface was removed). When stock expiry is enabled, expired stock can no longer be allocated to build orders or sales orders (manually, by serial number, or by auto-allocation) unless the corresponding setting is enabled. Existing allocations are not affected.
+- [#13369](https://github.com/inventree/InvenTree/pull/13369) The `PART_ALLOW_EDIT_IPN` setting is enforced again: when disabled, the IPN of an existing part cannot be changed.
+- [#13369](https://github.com/inventree/InvenTree/pull/13369) The `PART_COPY_TESTS`, `PART_CATEGORY_PARAMETERS` and `PART_CREATE_SUPPLIER` settings control the defaults of the part creation and duplication forms again.
### Removed
+- [#13369](https://github.com/inventree/InvenTree/pull/13369) Removes settings which have had no effect since the legacy user interface was removed (or were never implemented): `STOCK_SHOW_INSTALLED_ITEMS`, `PART_SHOW_RELATED`, `BARCODE_INPUT_DELAY` and `PLUGIN_UPDATE_CHECK` (global), and `REPORT_INLINE` and `LABEL_INLINE` (user).
+
## 1.7.0 - 2026-11.03
### Breaking Changes
diff --git a/docs/docs/settings/global.md b/docs/docs/settings/global.md
index 48b3313cfc..375fe4db87 100644
--- a/docs/docs/settings/global.md
+++ b/docs/docs/settings/global.md
@@ -98,7 +98,6 @@ Configuration of barcode functionality:
| Name | Description | Default | Units |
| ---- | ----------- | ------- | ----- |
{{ globalsetting("BARCODE_ENABLE") }}
-{{ globalsetting("BARCODE_INPUT_DELAY") }}
{{ globalsetting("BARCODE_WEBCAM_SUPPORT") }}
{{ globalsetting("BARCODE_SHOW_TEXT") }}
{{ globalsetting("BARCODE_GENERATION_PLUGIN") }}
@@ -170,7 +169,6 @@ Configuration of label printing:
{{ globalsetting("PART_ENABLE_REVISION") }}
{{ globalsetting("PART_REVISION_ASSEMBLY_ONLY") }}
{{ globalsetting("PART_NAME_FORMAT") }}
-{{ globalsetting("PART_SHOW_RELATED") }}
{{ globalsetting("PART_CREATE_INITIAL") }}
{{ globalsetting("PART_CREATE_SUPPLIER") }}
{{ globalsetting("PART_TEMPLATE") }}
@@ -225,7 +223,6 @@ Configuration of stock item options
{{ globalsetting("STOCK_ALLOW_EXPIRED_BUILD") }}
{{ globalsetting("STOCK_OWNERSHIP_CONTROL") }}
{{ globalsetting("STOCK_LOCATION_DEFAULT_ICON") }}
-{{ globalsetting("STOCK_SHOW_INSTALLED_ITEMS") }}
{{ globalsetting("STOCK_ENFORCE_BOM_INSTALLATION") }}
{{ globalsetting("STOCK_ALLOW_OUT_OF_STOCK_TRANSFER") }}
{{ globalsetting("STOCK_MERGE_ON_TRANSFER") }}
@@ -256,7 +253,6 @@ Refer to the [transfer order settings](../stock/transfer_order.md#transfer-order
| Name | Description | Default | Units |
| ---- | ----------- | ------- | ----- |
{{ globalsetting("PLUGIN_ON_STARTUP") }}
-{{ globalsetting("PLUGIN_UPDATE_CHECK") }}
{{ globalsetting("ENABLE_PLUGINS_URL") }}
{{ globalsetting("ENABLE_PLUGINS_NAVIGATION") }}
{{ globalsetting("ENABLE_PLUGINS_APP") }}
diff --git a/docs/docs/settings/user.md b/docs/docs/settings/user.md
index f036e24380..6134bf92ba 100644
--- a/docs/docs/settings/user.md
+++ b/docs/docs/settings/user.md
@@ -80,6 +80,4 @@ Settings for label printing and report generation:
| Name | Description | Default | Units |
| ---- | ----------- | ------- | ----- |
-{{ usersetting("REPORT_INLINE") }}
-{{ usersetting("LABEL_INLINE") }}
{{ usersetting("LABEL_DEFAULT_PRINTER") }}
diff --git a/docs/docs/stock/expiry.md b/docs/docs/stock/expiry.md
index 7433497d2b..6a5e7daf7f 100644
--- a/docs/docs/stock/expiry.md
+++ b/docs/docs/stock/expiry.md
@@ -6,43 +6,69 @@ title: Stock Expiry
InvenTree supports stock expiration dates, which allows individual stock items to be automatically marked as *expired* past a certain calendar date.
-The stock expiry feature is disabled by default, and must be enabled via the settings menu:
+The stock expiry feature is disabled by default, and must be enabled using the {{ globalsetting("STOCK_ENABLE_EXPIRY", short=True) }} setting:
{{ image("stock/enable_stock_expiry.png", title="Enable stock expiry feature") }}
+While the stock expiry feature is disabled, expiry dates are hidden from the stock forms and tables, and expired stock is not treated any differently to other stock.
!!! info "Non Expiring Stock"
- If a Stock Item is not expected to expire, leave the expiry date field blank, or zero
+ If a stock item is not expected to expire, leave its expiry date blank.
### Add Expiry Date
-When creating a new stock item, the expiry date can be manually set by the user.
+When creating a new stock item, the expiry date can be manually set by the user. If the part has a [default expiry time](#part-expiry-time), the expiry date is pre-filled accordingly.
{{ image("stock/expiry_date_create.png", title="Add expiry date") }}
-If an expiry date is defined for a particular stock item, it will be displayed on the detail page. If the expiry date has passed (and the stock item is *expired*) then this will also be indicated.
-
-{{ image("stock/item_expired.png", title="Display expiry date") }}
+When [receiving items](../purchasing/purchase_order.md) against a purchase order, an expiry date can optionally be specified for each received line item (also pre-filled from the default expiry time of the part).
The expiry date can be adjusted in the stock item edit form.
{{ image("stock/expiry_date_edit.png", title="Edit expiry date") }}
+### Expired and Stale Stock
+
+A stock item is:
+
+- **Expired** - if its expiry date has passed
+- **Stale** - if its expiry date is approaching, within the number of days specified by the {{ globalsetting("STOCK_STALE_DAYS", short=True) }} setting
+
+The stock item detail page displays an *Expired* or *Stale* badge where applicable, along with the expiry date of the stock item:
+
+{{ image("stock/item_expired.png", title="Display expiry date") }}
+
### Filter Expired Stock
-The various stock display tables can be filtered by *expired* status, and also display a column for the expiry date for each stock item.
+Stock item tables display a column for the expiry date of each stock item, and can be filtered by *Expired* and *Stale* status (or by a range of expiry dates).
{{ image("stock/stock_table_expiry.png", title="Filter by stock expiry") }}
-### Index Page
+### Dashboard
-If the stock expiry feature is enabled, expired stock are listed on the InvenTree home page, to provide visibility of expired stock to the users.
+The *Expired Stock Items* and *Stale Stock Items* [dashboard](../concepts/ui/index.md#dashboard) widgets show the number of expired (and stale) stock items, providing visibility of expired stock to users.
+
+### Using Expired Stock
+
+If the stock expiry feature is enabled, expired stock cannot be allocated to [build orders](../manufacturing/allocate.md) or [sales orders](../sales/sales_order.md) - whether manually, by serial number, or by auto-allocation. This can be changed with the following settings:
+
+| Setting | Description |
+| --- | --- |
+| {{ globalsetting("STOCK_ALLOW_EXPIRED_BUILD", short=True) }} | Allow expired stock to be allocated to build orders |
+| {{ globalsetting("STOCK_ALLOW_EXPIRED_SALE", short=True) }} | Allow expired stock to be allocated to sales orders |
+
+{{ image("stock/sell_build_expired_stock.png", title="Sell and build expired stock") }}
+
+Existing allocations are not affected if the allocated stock expires (or if these settings are changed).
+
+!!! info "Stock Availability"
+ Expired stock is still counted as *in stock* - refer to the [stock availability](./availability.md) documentation.
## Part Expiry Time
In addition to allowing manual configuration of expiry dates on a per-item basis, InvenTree also provides the ability to set a "default expiry time" for a particular Part. This expiry time (specified in *days*) is then used to automatically calculate the expiry date when creating a new Stock Item as an instance of the given Part.
-For example, if a Part has a default expiry time of 30 days, then any Stock Items created for that Part will automatically have their expiry date set to 30 days in the future.
+For example, if a Part has a default expiry time of 30 days, then any Stock Items created for that Part will automatically have their expiry date set to 30 days in the future (unless an expiry date is specified).
!!! info "Non Expiring Parts"
If a part is not expected to expire, set the default expiry time to 0 (zero) days.
@@ -61,11 +87,9 @@ InvenTree can automatically notify users when stock items are approaching their
### Configuration
-The stale stock notification system uses the `STOCK_STALE_DAYS` global setting to determine when to send notifications. This setting specifies how many days before expiry (or after expiry) to consider stock items as "stale".
+The stale stock notification system uses the {{ globalsetting("STOCK_STALE_DAYS", short=True) }} setting to determine when to send notifications. Any in-stock item with an expiry date earlier than this number of days in the future is included - this includes stock items which have *already* expired.
-For example, if `STOCK_STALE_DAYS` is set to 10:
-- Stock items expiring within the next 10 days will trigger notifications
-- Stock items that expired within the last 10 days will also trigger notifications
+For example, if {{ globalsetting("STOCK_STALE_DAYS", short=True) }} is set to 10, stock items which expire within the next 10 days (and any stock items which have already expired) will be included in the notifications.
### How It Works
@@ -75,18 +99,15 @@ The system runs a daily background task that:
2. **Groups by user**: Organizes stale items by users who are subscribed to notifications for the relevant parts
3. **Sends consolidated emails**: Each user receives a single email containing all their stale stock items
-
-
### Prerequisites
For stale stock notifications to work:
-1. **Stock expiry must be enabled**: The `STOCK_ENABLE_EXPIRY` setting must be enabled
-2. **Stale days configured**: The `STOCK_STALE_DAYS` setting must be greater than 0
+1. **Stock expiry must be enabled**: The {{ globalsetting("STOCK_ENABLE_EXPIRY", short=True) }} setting must be enabled
+2. **Stale days configured**: The {{ globalsetting("STOCK_STALE_DAYS", short=True) }} setting must be greater than 0
3. **Email configuration**: [Email settings](../settings/email.md) must be properly configured
4. **User subscriptions**: Users must be subscribed to notifications for the relevant parts
-
### User Subscriptions
Users will only receive notifications for parts they are subscribed to. To subscribe to part notifications:
@@ -96,9 +117,3 @@ Users will only receive notifications for parts they are subscribed to. To subsc
3. Users can also subscribe to entire part categories
For more information on part subscriptions, see the [Part Notifications](../part/notification.md) documentation.
-
-## Sales and Build Orders
-
-By default, expired Stock Items cannot be added to neither a Sales Order nor a Build Order. This behavior can be adjusted using the *Sell Expired Stock* and *Build Expired Stock* settings:
-
-{{ image("stock/sell_build_expired_stock.png", title="Sell and build expired stock") }}
diff --git a/docs/docs/stock/tracking.md b/docs/docs/stock/tracking.md
index d412f0bc1f..469aae20ee 100644
--- a/docs/docs/stock/tracking.md
+++ b/docs/docs/stock/tracking.md
@@ -72,7 +72,7 @@ There are two ways that a stock item can become installed inside another:
Any stock items installed within a particular stock item are displayed on the *Installed Items* tab of the *Stock Item Detail* page.
-By default, installed stock items are hidden from general stock item tables (as they are not directly available for use) - this can be changed using the {{ globalsetting("STOCK_SHOW_INSTALLED_ITEMS", short=True) }} setting.
+Installed stock items are not *in stock*, so they are hidden from stock item tables which only display in-stock items (the default). To display installed items in a stock table, remove the *In Stock* filter, or use the *Installed* filter.
### Removing Installed Items
diff --git a/src/backend/InvenTree/build/models.py b/src/backend/InvenTree/build/models.py
index 10acf575bc..96021c728a 100644
--- a/src/backend/InvenTree/build/models.py
+++ b/src/backend/InvenTree/build/models.py
@@ -1693,6 +1693,11 @@ class Build(
"""
location = kwargs.get('location')
exclude_location = kwargs.get('exclude_location')
+
+ # Exclude expired stock (unless it may be used for building)
+ expiry_filter = stock.models.StockItem.allowed_expiry_filter(
+ 'STOCK_ALLOW_EXPIRED_BUILD'
+ )
substitutes = kwargs.get('substitutes', True)
optional_items = kwargs.get('optional_items', False)
@@ -1742,6 +1747,8 @@ class Build(
serial=output.serial,
).exclude(Q(serial=None) | Q(serial=''))
+ available_stock = available_stock.filter(expiry_filter)
+
if location:
# Filter only stock items located "below" the specified location
sublocations = location.get_descendants(include_self=True)
@@ -1824,6 +1831,11 @@ class Build(
stock_sort_by = kwargs.get('stock_sort_by', stock.models.STOCK_SORT_DEFAULT)
line_ids = kwargs.get('line_ids')
+ # Exclude expired stock (unless it may be used for building)
+ expiry_filter = stock.models.StockItem.allowed_expiry_filter(
+ 'STOCK_ALLOW_EXPIRED_BUILD'
+ )
+
def stock_sort(item, bom_item, variant_parts):
if item.part == bom_item.sub_part:
return 1
@@ -1892,7 +1904,7 @@ class Build(
# function below, which inspects item.part for every candidate.
available_stock = stock.models.StockItem.objects.select_related(
'part'
- ).filter(stock.models.StockItem.IN_STOCK_FILTER)
+ ).filter(stock.models.StockItem.IN_STOCK_FILTER, expiry_filter)
# Filter by list of available parts
available_stock = available_stock.filter(part__in=list(available_parts))
@@ -2373,6 +2385,13 @@ class BuildItem(InvenTreeMetadataModel):
)
)
+ # Expired stock may only be newly allocated if permitted
+ # (existing allocations of since-expired stock remain editable)
+ if self._state.adding:
+ self.stock_item.check_expired_allowed(
+ 'STOCK_ALLOW_EXPIRED_BUILD', field='stock_item'
+ )
+
self.check_allocated_quantity(raise_error=raise_error)
except stock.models.StockItem.DoesNotExist:
diff --git a/src/backend/InvenTree/build/serializers.py b/src/backend/InvenTree/build/serializers.py
index 1b97c4bdc1..a045a826f1 100644
--- a/src/backend/InvenTree/build/serializers.py
+++ b/src/backend/InvenTree/build/serializers.py
@@ -920,6 +920,9 @@ class BuildAllocationItemSerializer(serializers.Serializer):
if not stock_item.in_stock:
raise ValidationError(_('Item must be in stock'))
+ # Expired stock may only be allocated if permitted
+ stock_item.check_expired_allowed('STOCK_ALLOW_EXPIRED_BUILD')
+
return stock_item
quantity = serializers.DecimalField(
diff --git a/src/backend/InvenTree/common/setting/system.py b/src/backend/InvenTree/common/setting/system.py
index 4d62dcffe2..e9bf4bb364 100644
--- a/src/backend/InvenTree/common/setting/system.py
+++ b/src/backend/InvenTree/common/setting/system.py
@@ -377,13 +377,6 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'default': 100,
'validator': [int, MinValueValidator(1)],
},
- 'BARCODE_INPUT_DELAY': {
- 'name': _('Barcode Input Delay'),
- 'description': _('Barcode input processing delay time'),
- 'default': 50,
- 'validator': [int, MinValueValidator(1)],
- 'units': 'ms',
- },
'BARCODE_WEBCAM_SUPPORT': {
'name': _('Barcode Webcam Support'),
'description': _('Allow barcode scanning via webcam in browser'),
@@ -550,12 +543,6 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'validator': bool,
'requires_restart': True,
},
- 'PLUGIN_UPDATE_CHECK': {
- 'name': _('Check for plugin updates'),
- 'description': _('Enable periodic checks for updates to installed plugins'),
- 'default': True,
- 'validator': bool,
- },
# Settings for plugin mixin features
'ENABLE_PLUGINS_URL': {
'name': _('Enable URL integration'),
diff --git a/src/backend/InvenTree/common/setting/user.py b/src/backend/InvenTree/common/setting/user.py
index f50c4a6ed5..1e3bfeb4c5 100644
--- a/src/backend/InvenTree/common/setting/user.py
+++ b/src/backend/InvenTree/common/setting/user.py
@@ -19,28 +19,12 @@ def label_printer_options():
USER_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
- 'LABEL_INLINE': {
- 'name': _('Inline label display'),
- 'description': _(
- 'Display PDF labels in the browser, instead of downloading as a file'
- ),
- 'default': True,
- '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': {
- 'name': _('Inline report display'),
- 'description': _(
- 'Display PDF reports in the browser, instead of downloading as a file'
- ),
- 'default': False,
- 'validator': bool,
- },
'BARCODE_IN_FORM_FIELDS': {
'name': _('Barcode Scanner in Form Fields'),
'description': _('Allow barcode scanner input in form fields'),
diff --git a/src/backend/InvenTree/common/tests.py b/src/backend/InvenTree/common/tests.py
index 4aaef7fb37..c743cde786 100644
--- a/src/backend/InvenTree/common/tests.py
+++ b/src/backend/InvenTree/common/tests.py
@@ -857,7 +857,9 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
)
# Check the detail API endpoint
- url = reverse('api-user-setting-detail', kwargs={'key': 'LABEL_INLINE'})
+ url = reverse(
+ 'api-user-setting-detail', kwargs={'key': 'SEARCH_PREVIEW_SHOW_PARTS'}
+ )
self.get(url, expected_code=401)
def test_user_settings_api_list(self):
@@ -900,7 +902,7 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
def test_user_setting_init(self):
"""Test we can retrieve a setting which has not yet been initialized."""
- key = 'LABEL_INLINE'
+ key = 'SEARCH_PREVIEW_SHOW_PARTS'
# Ensure it does not actually exist in the database
self.assertFalse(InvenTreeUserSetting.objects.filter(key=key).exists())
diff --git a/src/backend/InvenTree/order/models.py b/src/backend/InvenTree/order/models.py
index daddf0f222..94ffb9db7c 100644
--- a/src/backend/InvenTree/order/models.py
+++ b/src/backend/InvenTree/order/models.py
@@ -1698,7 +1698,11 @@ class SalesOrder(AuditedOrderMixin, TotalPriceMixin, Order):
continue
available_stock = stock.models.StockItem.objects.filter(
- stock.models.StockItem.IN_STOCK_FILTER, part=line_item.part
+ stock.models.StockItem.IN_STOCK_FILTER,
+ stock.models.StockItem.allowed_expiry_filter(
+ 'STOCK_ALLOW_EXPIRED_SALE'
+ ),
+ part=line_item.part,
)
if location:
@@ -1841,6 +1845,13 @@ class SalesOrder(AuditedOrderMixin, TotalPriceMixin, Order):
serials_unavailable.add(serial)
continue
+ # Expired stock may only be allocated if permitted
+ try:
+ stock_item.check_expired_allowed('STOCK_ALLOW_EXPIRED_SALE')
+ except ValidationError:
+ serials_unavailable.add(serial)
+ continue
+
# Lock the StockItem row, so that concurrent allocation requests are
# serialized against each other, and re-validate the unallocated
# quantity against the now-current (and now-locked) state
@@ -3330,6 +3341,14 @@ class SalesOrderAllocation(models.Model):
if self.quantity > self.item.quantity:
errors['quantity'] = _('Allocation quantity cannot exceed stock quantity')
+ # Expired stock may only be newly allocated if permitted
+ # (existing allocations of since-expired stock remain editable)
+ if self._state.adding:
+ try:
+ self.item.check_expired_allowed('STOCK_ALLOW_EXPIRED_SALE')
+ except ValidationError as exc:
+ errors['item'] = exc.messages
+
# Ensure that we do not 'over allocate' a stock item
build_allocation_count = self.item.build_allocation_count()
sales_allocation_count = self.item.sales_order_allocation_count(
diff --git a/src/backend/InvenTree/order/serializers.py b/src/backend/InvenTree/order/serializers.py
index fab0543eb8..efdad7348a 100644
--- a/src/backend/InvenTree/order/serializers.py
+++ b/src/backend/InvenTree/order/serializers.py
@@ -1825,6 +1825,9 @@ class SalesOrderShipmentAllocationItemSerializer(serializers.Serializer):
'quantity': _('Quantity must be 1 for serialized stock item')
})
+ # Expired stock may only be allocated if permitted
+ stock_item.check_expired_allowed('STOCK_ALLOW_EXPIRED_SALE', field='stock_item')
+
q = normalize(stock_item.unallocated_quantity())
if quantity > q:
diff --git a/src/backend/InvenTree/part/serializers.py b/src/backend/InvenTree/part/serializers.py
index 8fda5ab83e..ef83661d13 100644
--- a/src/backend/InvenTree/part/serializers.py
+++ b/src/backend/InvenTree/part/serializers.py
@@ -27,6 +27,7 @@ import part.helpers as part_helpers
import stock.models
import users.models
import users.permissions
+from common.settings import get_global_setting
from data_exporter.mixins import DataExportSerializerMixin
from importer.registry import register_importer
from InvenTree.mixins import DataImportExportSerializerMixin
@@ -972,6 +973,20 @@ class PartSerializer(
allow_blank=False,
)
+ def validate_IPN(self, value):
+ """Ensure that the IPN of an existing part can only be changed if permitted."""
+ part = self.instance
+
+ if isinstance(part, Part) and part.pk:
+ if (value or '') != (part.IPN or '') and not get_global_setting(
+ 'PART_ALLOW_EDIT_IPN', True, cache=False
+ ):
+ raise serializers.ValidationError(
+ _('The IPN of an existing part cannot be changed')
+ )
+
+ return value
+
def validate_existing_image(self, img):
"""Validate the selected image file."""
if not img:
diff --git a/src/backend/InvenTree/part/system_settings.py b/src/backend/InvenTree/part/system_settings.py
index 26322d8499..5cd7ccb85f 100644
--- a/src/backend/InvenTree/part/system_settings.py
+++ b/src/backend/InvenTree/part/system_settings.py
@@ -124,12 +124,6 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'default': False,
'validator': bool,
},
- 'PART_SHOW_RELATED': {
- 'name': _('Show related parts'),
- 'description': _('Display related parts for a part'),
- 'default': True,
- 'validator': bool,
- },
'PART_CREATE_INITIAL': {
'name': _('Initial Stock Data'),
'description': _('Allow creation of initial stock when adding a new part'),
diff --git a/src/backend/InvenTree/part/test_api.py b/src/backend/InvenTree/part/test_api.py
index a844a432b4..953e542a6d 100644
--- a/src/backend/InvenTree/part/test_api.py
+++ b/src/backend/InvenTree/part/test_api.py
@@ -3879,3 +3879,45 @@ class PartApiPerformanceTest(PartAPITestBase, InvenTreeAPIPerformanceTestCase):
url = reverse('api-part-list')
response = self.get(url, expected_code=200)
self.assertGreater(len(response.data), 13)
+
+
+class PartIPNEditTest(InvenTreeAPITestCase):
+ """Tests for the PART_ALLOW_EDIT_IPN setting."""
+
+ roles = ['part.add', 'part.change', 'part.view', 'part_category.view']
+
+ def setUp(self):
+ """Create a part with an IPN."""
+ super().setUp()
+ self.part = Part.objects.create(name='IPN Widget', IPN='IPN-001')
+ self.url = reverse('api-part-detail', kwargs={'pk': self.part.pk})
+
+ def test_edit_allowed(self):
+ """The IPN can be changed when permitted (the default)."""
+ set_global_setting('PART_ALLOW_EDIT_IPN', True)
+
+ self.patch(self.url, {'IPN': 'IPN-002'}, expected_code=200)
+ self.part.refresh_from_db()
+ self.assertEqual(self.part.IPN, 'IPN-002')
+
+ def test_edit_blocked(self):
+ """The IPN of an existing part cannot be changed when not permitted."""
+ set_global_setting('PART_ALLOW_EDIT_IPN', False)
+
+ response = self.patch(self.url, {'IPN': 'IPN-002'}, expected_code=400)
+ self.assertIn('cannot be changed', str(response.data['IPN']))
+
+ self.part.refresh_from_db()
+ self.assertEqual(self.part.IPN, 'IPN-001')
+
+ # Other fields can still be edited, and re-submitting the same IPN is fine
+ self.patch(
+ self.url, {'IPN': 'IPN-001', 'description': 'Updated'}, expected_code=200
+ )
+
+ # A new part can still be created with an IPN
+ self.post(
+ reverse('api-part-list'),
+ {'name': 'IPN Widget 2', 'IPN': 'IPN-003', 'description': 'New part'},
+ expected_code=201,
+ )
diff --git a/src/backend/InvenTree/stock/models.py b/src/backend/InvenTree/stock/models.py
index dd4b9704ed..1e86c63728 100644
--- a/src/backend/InvenTree/stock/models.py
+++ b/src/backend/InvenTree/stock/models.py
@@ -693,6 +693,51 @@ class StockItem(
& Q(expiry_date__lt=InvenTree.helpers.current_date())
)
+ @staticmethod
+ def allow_expired_stock(setting: str) -> bool:
+ """Return True if expired stock may be used for a particular purpose.
+
+ Arguments:
+ setting: The global setting which controls whether expired stock may be used
+ (e.g. 'STOCK_ALLOW_EXPIRED_BUILD' or 'STOCK_ALLOW_EXPIRED_SALE')
+
+ Expired stock is always allowed if the stock expiry feature is disabled.
+ """
+ if not get_global_setting('STOCK_ENABLE_EXPIRY', False):
+ return True
+
+ return bool(get_global_setting(setting, False))
+
+ @classmethod
+ def allowed_expiry_filter(cls, setting: str) -> Q:
+ """Return a filter which excludes expired stock, if it may not be used for a particular purpose.
+
+ Arguments:
+ setting: The global setting which controls whether expired stock may be used
+ """
+ if cls.allow_expired_stock(setting):
+ return Q()
+
+ return Q(expiry_date=None) | Q(
+ expiry_date__gte=InvenTree.helpers.current_date()
+ )
+
+ def check_expired_allowed(self, setting: str, field: str | None = None) -> None:
+ """Raise a ValidationError if this item has expired, and expired stock may not be used.
+
+ Arguments:
+ setting: The global setting which controls whether expired stock may be used
+ field: Optional field name to associate the error with
+ """
+ expired = (
+ self.expiry_date is not None
+ and self.expiry_date < InvenTree.helpers.current_date()
+ )
+
+ if expired and not StockItem.allow_expired_stock(setting):
+ msg = _('Expired stock cannot be used')
+ raise ValidationError({field: msg} if field else msg)
+
@staticmethod
def _lock_serial_numbers(part: PartModels.Part, serials: list) -> None:
"""Serialize concurrent serial number creation, and re-validate under the lock.
diff --git a/src/backend/InvenTree/stock/system_settings.py b/src/backend/InvenTree/stock/system_settings.py
index a82064a7dc..901f3718f3 100644
--- a/src/backend/InvenTree/stock/system_settings.py
+++ b/src/backend/InvenTree/stock/system_settings.py
@@ -70,12 +70,6 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'default': '',
'validator': common.validators.validate_icon,
},
- 'STOCK_SHOW_INSTALLED_ITEMS': {
- 'name': _('Show Installed Stock Items'),
- 'description': _('Display installed stock items in stock tables'),
- 'default': False,
- 'validator': bool,
- },
'STOCK_ENFORCE_BOM_INSTALLATION': {
'name': _('Check BOM when installing items'),
'description': _(
diff --git a/src/backend/InvenTree/stock/test_expired_allocation.py b/src/backend/InvenTree/stock/test_expired_allocation.py
new file mode 100644
index 0000000000..2139aee9e7
--- /dev/null
+++ b/src/backend/InvenTree/stock/test_expired_allocation.py
@@ -0,0 +1,267 @@
+"""Tests for the STOCK_ALLOW_EXPIRED_BUILD and STOCK_ALLOW_EXPIRED_SALE settings.
+
+When stock expiry is enabled, expired stock may only be allocated to build orders
+(or sales orders) if the corresponding setting permits it.
+"""
+
+from datetime import timedelta
+
+from django.core.exceptions import ValidationError
+from django.urls import reverse
+
+import InvenTree.helpers
+from build.models import Build, BuildItem, BuildLine
+from build.status_codes import BuildStatus
+from common.settings import set_global_setting
+from company.models import Company
+from InvenTree.unit_test import InvenTreeAPITestCase
+from order.models import (
+ SalesOrder,
+ SalesOrderAllocation,
+ SalesOrderLineItem,
+ SalesOrderShipment,
+)
+from part.models import BomItem, Part
+from stock.models import StockItem, StockLocation
+
+
+class ExpiredAllocationTestBase(InvenTreeAPITestCase):
+ """Common data for expired allocation tests."""
+
+ roles = ['build.add', 'build.change', 'sales_order.add', 'sales_order.change']
+
+ @classmethod
+ def setUpTestData(cls):
+ """Create parts, stock, a build order and a sales order."""
+ super().setUpTestData()
+
+ cls.location = StockLocation.objects.create(name='Expiry Store')
+
+ cls.component = Part.objects.create(
+ name='Expiring Component', component=True, salable=True
+ )
+
+ cls.assembly = Part.objects.create(name='Expiry Assembly', assembly=True)
+
+ BomItem.objects.create(part=cls.assembly, sub_part=cls.component, quantity=1)
+
+ today = InvenTree.helpers.current_date()
+
+ cls.expired = StockItem.objects.create(
+ part=cls.component,
+ quantity=10,
+ location=cls.location,
+ expiry_date=today - timedelta(days=10),
+ )
+
+ cls.customer = Company.objects.create(name='Expiry Customer', is_customer=True)
+
+ def setUp(self):
+ """Enable stock expiry by default."""
+ super().setUp()
+ self.set_rules(expiry=True, build=False, sale=False)
+
+ def set_rules(self, expiry: bool, build: bool, sale: bool):
+ """Configure the stock expiry settings."""
+ set_global_setting('STOCK_ENABLE_EXPIRY', expiry)
+ set_global_setting('STOCK_ALLOW_EXPIRED_BUILD', build)
+ set_global_setting('STOCK_ALLOW_EXPIRED_SALE', sale)
+
+ def fresh_stock(self, quantity=10):
+ """Create a stock item which has not expired."""
+ return StockItem.objects.create(
+ part=self.component,
+ quantity=quantity,
+ location=self.location,
+ expiry_date=InvenTree.helpers.current_date() + timedelta(days=30),
+ )
+
+
+class BuildExpiredAllocationTest(ExpiredAllocationTestBase):
+ """Allocation of expired stock to build orders."""
+
+ def setUp(self):
+ """Create a build order for each test."""
+ super().setUp()
+
+ self.build = Build.objects.create(
+ part=self.assembly,
+ quantity=5,
+ reference='BO-9876',
+ status=BuildStatus.PRODUCTION,
+ )
+
+ self.line = BuildLine.objects.get(build=self.build)
+
+ def allocate(self, item, expected_code):
+ """Allocate a stock item against the build via the API."""
+ return self.post(
+ reverse('api-build-allocate', kwargs={'pk': self.build.pk}),
+ {
+ 'items': [
+ {'build_line': self.line.pk, 'stock_item': item.pk, 'quantity': 1}
+ ]
+ },
+ expected_code=expected_code,
+ )
+
+ def test_api_blocked(self):
+ """Expired stock cannot be allocated when not permitted."""
+ response = self.allocate(self.expired, 400)
+ self.assertIn('Expired stock cannot be used', str(response.data))
+ self.assertFalse(BuildItem.objects.filter(stock_item=self.expired).exists())
+
+ # Stock which has not expired can still be allocated
+ self.allocate(self.fresh_stock(), 201)
+
+ def test_api_allowed(self):
+ """Expired stock can be allocated when permitted (or when expiry is disabled)."""
+ self.set_rules(expiry=True, build=True, sale=False)
+ self.allocate(self.expired, 201)
+
+ BuildItem.objects.all().delete()
+
+ self.set_rules(expiry=False, build=False, sale=False)
+ self.allocate(self.expired, 201)
+
+ def test_auto_allocate(self):
+ """Auto-allocation skips expired stock when not permitted."""
+ self.build.auto_allocate_stock()
+ self.assertEqual(self.build.allocated_stock.count(), 0)
+
+ # With fresh stock available, only the fresh stock is allocated
+ fresh = self.fresh_stock()
+ self.build.auto_allocate_stock()
+ self.assertEqual(
+ list(self.build.allocated_stock.values_list('stock_item', flat=True)),
+ [fresh.pk],
+ )
+
+ def test_auto_allocate_allowed(self):
+ """Auto-allocation uses expired stock when permitted."""
+ self.set_rules(expiry=True, build=True, sale=False)
+
+ self.build.auto_allocate_stock()
+ self.assertEqual(
+ list(self.build.allocated_stock.values_list('stock_item', flat=True)),
+ [self.expired.pk],
+ )
+
+ def test_model_validation(self):
+ """A new BuildItem cannot allocate expired stock, but existing allocations remain editable."""
+ with self.assertRaises(ValidationError):
+ BuildItem(build_line=self.line, stock_item=self.expired, quantity=1).clean()
+
+ # Allocate while permitted, then disallow
+ self.set_rules(expiry=True, build=True, sale=False)
+ item = BuildItem.objects.create(
+ build_line=self.line, stock_item=self.expired, quantity=1
+ )
+ self.set_rules(expiry=True, build=False, sale=False)
+
+ item.quantity = 2
+ item.clean()
+ item.save()
+
+
+class SalesOrderExpiredAllocationTest(ExpiredAllocationTestBase):
+ """Allocation of expired stock to sales orders."""
+
+ def setUp(self):
+ """Create a sales order for each test."""
+ super().setUp()
+
+ self.order = SalesOrder.objects.create(
+ customer=self.customer, reference='SO-9876'
+ )
+ self.shipment = SalesOrderShipment.objects.create(
+ order=self.order, reference='1'
+ )
+ self.line = SalesOrderLineItem.objects.create(
+ order=self.order, part=self.component, quantity=5
+ )
+
+ def allocate(self, item, expected_code):
+ """Allocate a stock item against the sales order via the API."""
+ return self.post(
+ reverse('api-so-allocate', kwargs={'pk': self.order.pk}),
+ {
+ 'items': [
+ {'line_item': self.line.pk, 'stock_item': item.pk, 'quantity': 1}
+ ],
+ 'shipment': self.shipment.pk,
+ },
+ expected_code=expected_code,
+ )
+
+ def test_api_blocked(self):
+ """Expired stock cannot be allocated when not permitted."""
+ response = self.allocate(self.expired, 400)
+ self.assertIn('Expired stock cannot be used', str(response.data))
+
+ self.allocate(self.fresh_stock(), 201)
+
+ def test_api_allowed(self):
+ """Expired stock can be allocated when permitted (or when expiry is disabled)."""
+ self.set_rules(expiry=True, build=False, sale=True)
+ self.allocate(self.expired, 201)
+
+ SalesOrderAllocation.objects.all().delete()
+
+ self.set_rules(expiry=False, build=False, sale=False)
+ self.allocate(self.expired, 201)
+
+ def test_auto_allocate(self):
+ """Auto-allocation skips expired stock when not permitted."""
+ self.order.auto_allocate_stock(shipment=self.shipment)
+ self.assertFalse(SalesOrderAllocation.objects.filter(line=self.line).exists())
+
+ self.set_rules(expiry=True, build=False, sale=True)
+ self.order.auto_allocate_stock(shipment=self.shipment)
+ self.assertTrue(
+ SalesOrderAllocation.objects.filter(
+ line=self.line, item=self.expired
+ ).exists()
+ )
+
+ def test_serial_allocation(self):
+ """Expired serialized stock cannot be allocated by serial number when not permitted."""
+ tracked = Part.objects.create(
+ name='Expiring Tracked', salable=True, trackable=True
+ )
+ StockItem.objects.create(
+ part=tracked,
+ quantity=1,
+ serial='EXP-1',
+ location=self.location,
+ expiry_date=InvenTree.helpers.current_date() - timedelta(days=1),
+ )
+ line = SalesOrderLineItem.objects.create(
+ order=self.order, part=tracked, quantity=1
+ )
+
+ with self.assertRaises(ValidationError):
+ self.order.allocate_serial_numbers(line, 1, 'EXP-1', self.shipment)
+
+ self.set_rules(expiry=True, build=False, sale=True)
+ allocations = self.order.allocate_serial_numbers(
+ line, 1, 'EXP-1', self.shipment
+ )
+ self.assertEqual(len(allocations), 1)
+
+ def test_model_validation(self):
+ """A new allocation cannot use expired stock, but existing allocations remain editable."""
+ with self.assertRaises(ValidationError):
+ SalesOrderAllocation(
+ line=self.line, shipment=self.shipment, item=self.expired, quantity=1
+ ).clean()
+
+ self.set_rules(expiry=True, build=False, sale=True)
+ allocation = SalesOrderAllocation.objects.create(
+ line=self.line, shipment=self.shipment, item=self.expired, quantity=1
+ )
+ self.set_rules(expiry=True, build=False, sale=False)
+
+ allocation.quantity = 2
+ allocation.clean()
+ allocation.save()
diff --git a/src/frontend/src/forms/PartForms.tsx b/src/frontend/src/forms/PartForms.tsx
index 2aa8408297..c263839fc2 100644
--- a/src/frontend/src/forms/PartForms.tsx
+++ b/src/frontend/src/forms/PartForms.tsx
@@ -56,7 +56,10 @@ export function usePartFields({
}
},
name: {},
- IPN: {},
+ IPN: {
+ // The IPN of an existing part can only be changed if permitted
+ disabled: !create && !globalSettings.isSet('PART_ALLOW_EDIT_IPN', true)
+ },
description: {},
revision: {},
revision_of: {
@@ -148,7 +151,9 @@ export function usePartFields({
// Additional fields for creation
if (create && !virtual) {
- fields.copy_category_parameters = {};
+ fields.copy_category_parameters = {
+ value: globalSettings.isSet('PART_CATEGORY_PARAMETERS', true)
+ };
if (globalSettings.isSet('PART_CREATE_INITIAL')) {
fields.initial_stock = {
@@ -168,7 +173,7 @@ export function usePartFields({
};
}
- if (purchaseable) {
+ if (purchaseable && globalSettings.isSet('PART_CREATE_SUPPLIER', true)) {
fields.initial_supplier = {
icon: ,
children: {
@@ -212,7 +217,7 @@ export function usePartFields({
value: globalSettings.isSet('PART_COPY_PARAMETERS')
},
copy_tests: {
- value: true,
+ value: globalSettings.isSet('PART_COPY_TESTS', true),
hidden: !duplicatePartInstance?.testable
}
}
diff --git a/src/frontend/src/pages/Index/Settings/AdminCenter/PluginManagementPanel.tsx b/src/frontend/src/pages/Index/Settings/AdminCenter/PluginManagementPanel.tsx
index c5c8db48ad..5555e4e6b7 100644
--- a/src/frontend/src/pages/Index/Settings/AdminCenter/PluginManagementPanel.tsx
+++ b/src/frontend/src/pages/Index/Settings/AdminCenter/PluginManagementPanel.tsx
@@ -27,8 +27,7 @@ export const PLUGIN_SETTINGS_KEYS = [
'ENABLE_PLUGINS_NAVIGATION',
'ENABLE_PLUGINS_APP',
'ENABLE_PLUGINS_MAILS',
- 'PLUGIN_ON_STARTUP',
- 'PLUGIN_UPDATE_CHECK'
+ 'PLUGIN_ON_STARTUP'
];
export default function PluginManagementPanel() {
diff --git a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx
index 3411020a4d..9fe5093aae 100644
--- a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx
+++ b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx
@@ -117,7 +117,6 @@ export default function SystemSettings() {
,
- content: (
-
- )
+ content:
},
{
name: 'plugins',
diff --git a/src/frontend/src/tables/part/PartTable.tsx b/src/frontend/src/tables/part/PartTable.tsx
index 9845da7279..d13df71d52 100644
--- a/src/frontend/src/tables/part/PartTable.tsx
+++ b/src/frontend/src/tables/part/PartTable.tsx
@@ -186,7 +186,9 @@ export function PartListTable({
value: globalSettings.isSet('PART_COPY_PARAMETERS')
},
copy_tests: {
- value: selectedPart.testable,
+ value:
+ selectedPart.testable &&
+ globalSettings.isSet('PART_COPY_TESTS', true),
hidden: !selectedPart.testable
}
}
diff --git a/src/frontend/tests/pages/pui_part_settings.spec.ts b/src/frontend/tests/pages/pui_part_settings.spec.ts
new file mode 100644
index 0000000000..a0c99a8e15
--- /dev/null
+++ b/src/frontend/tests/pages/pui_part_settings.spec.ts
@@ -0,0 +1,157 @@
+import { createApi } from '../api.js';
+import { expect, generateUUID, test } from '../baseFixtures.js';
+import { openDetailAction } from '../helpers.js';
+import { doCachedLogin } from '../login.js';
+import { setSettingState } from '../settings.js';
+
+/**
+ * Tests that the part settings are respected by the part forms.
+ * Each test restores the (default) setting values when complete.
+ */
+
+/**
+ * Create a new part via the API, returning the created part data
+ */
+const createPart = async (data: object) => {
+ const api = await createApi({});
+ const response = await api.post('part/', {
+ data: {
+ name: `Settings part ${generateUUID().slice(0, 8)}`,
+ description: 'Part for settings tests',
+ ...data
+ }
+ });
+ expect(response.status(), await response.text()).toBe(201);
+ const part = await response.json();
+ await api.dispose();
+ return part;
+};
+
+/**
+ * Remove a part created by createPart()
+ */
+const deletePartById = async (pk: number) => {
+ const api = await createApi({});
+ await api.patch(`part/${pk}/`, { data: { active: false } });
+ await api.delete(`part/${pk}/`);
+ await api.dispose();
+};
+
+test('Parts - Settings - Create Part Form', async ({ browser }) => {
+ const openCreateForm = async (page) => {
+ await page.getByRole('button', { name: 'action-menu-add-parts' }).click();
+ await page
+ .getByRole('menuitem', { name: 'action-menu-add-parts-create-part' })
+ .click();
+ await page.getByLabel('text-field-name', { exact: true }).waitFor();
+ };
+
+ const copyParameters = (page) =>
+ page.getByRole('switch', {
+ name: 'boolean-field-copy_category_parameters'
+ });
+
+ const supplierField = (page) =>
+ page.getByLabel('related-field-initial_supplier.supplier');
+
+ try {
+ await setSettingState({
+ setting: 'PART_CATEGORY_PARAMETERS',
+ value: false
+ });
+ await setSettingState({ setting: 'PART_CREATE_SUPPLIER', value: false });
+ await setSettingState({ setting: 'PART_ALLOW_EDIT_IPN', value: false });
+
+ const page = await doCachedLogin(browser, {
+ url: 'part/category/index/parts'
+ });
+
+ // Disabled: parameters are not copied by default, and supplier data is not offered
+ await openCreateForm(page);
+ await expect(copyParameters(page)).not.toBeChecked();
+ await expect(supplierField(page)).toHaveCount(0);
+
+ // The IPN can always be set when creating a new part
+ await expect(
+ page.getByRole('textbox', { name: 'text-field-IPN' })
+ ).toBeEnabled();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+
+ await setSettingState({ setting: 'PART_CATEGORY_PARAMETERS', value: true });
+ await setSettingState({ setting: 'PART_CREATE_SUPPLIER', value: true });
+
+ // Enabled: parameters are copied by default, and supplier data is offered
+ await page.reload();
+ await openCreateForm(page);
+ await expect(copyParameters(page)).toBeChecked();
+ await expect(supplierField(page)).toBeVisible();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ } finally {
+ await setSettingState({ setting: 'PART_CATEGORY_PARAMETERS', value: true });
+ await setSettingState({ setting: 'PART_CREATE_SUPPLIER', value: true });
+ await setSettingState({ setting: 'PART_ALLOW_EDIT_IPN', value: true });
+ }
+});
+
+test('Parts - Settings - Duplicate Part Tests', async ({ browser }) => {
+ const part = await createPart({ testable: true });
+
+ const copyTests = (page) =>
+ page.getByRole('switch', { name: 'boolean-field-duplicate.copy_tests' });
+
+ try {
+ await setSettingState({ setting: 'PART_COPY_TESTS', value: false });
+
+ const page = await doCachedLogin(browser, {
+ url: `part/${part.pk}/details`
+ });
+
+ // Disabled: test templates are not copied by default
+ await openDetailAction(page, 'part', 'duplicate');
+ await expect(copyTests(page)).not.toBeChecked();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+
+ await setSettingState({ setting: 'PART_COPY_TESTS', value: true });
+
+ // Enabled: test templates are copied by default
+ await page.reload();
+ await openDetailAction(page, 'part', 'duplicate');
+ await expect(copyTests(page)).toBeChecked();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ } finally {
+ await setSettingState({ setting: 'PART_COPY_TESTS', value: true });
+ await deletePartById(part.pk);
+ }
+});
+
+test('Parts - Settings - Edit IPN', async ({ browser }) => {
+ const part = await createPart({ IPN: `IPN-${generateUUID().slice(0, 8)}` });
+
+ const ipnField = (page) =>
+ page.getByRole('textbox', { name: 'text-field-IPN' });
+
+ try {
+ await setSettingState({ setting: 'PART_ALLOW_EDIT_IPN', value: false });
+
+ const page = await doCachedLogin(browser, {
+ url: `part/${part.pk}/details`
+ });
+
+ // Disabled: the IPN of an existing part cannot be edited
+ await openDetailAction(page, 'part', 'edit');
+ await expect(ipnField(page)).toHaveValue(part.IPN);
+ await expect(ipnField(page)).toBeDisabled();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+
+ await setSettingState({ setting: 'PART_ALLOW_EDIT_IPN', value: true });
+
+ // Enabled: the IPN can be edited
+ await page.reload();
+ await openDetailAction(page, 'part', 'edit');
+ await expect(ipnField(page)).toBeEnabled();
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ } finally {
+ await setSettingState({ setting: 'PART_ALLOW_EDIT_IPN', value: true });
+ await deletePartById(part.pk);
+ }
+});
diff --git a/src/frontend/tests/pui_settings.spec.ts b/src/frontend/tests/pui_settings.spec.ts
index ab4ef2daf2..49cd43b6ae 100644
--- a/src/frontend/tests/pui_settings.spec.ts
+++ b/src/frontend/tests/pui_settings.spec.ts
@@ -125,20 +125,22 @@ test('Settings - User', async ({ browser }) => {
await page.getByText('Whole Word Search').waitFor();
await page.getByText('Hide Unavailable Stock Items').waitFor();
+ // Toggle boolean setting (twice, to restore the original value)
+ for (let ii = 0; ii < 2; ii++) {
+ await page
+ .getByLabel('setting-SEARCH_WHOLE-wrapper')
+ .locator('span')
+ .nth(1)
+ .click();
+ }
+
await loadTab(page, 'Notifications');
await page
.getByRole('button', { name: 'InvenTree Email Notifications' })
.waitFor();
await loadTab(page, 'Reporting');
- await page.getByText('Inline report display').waitFor();
-
- // Toggle boolean setting
- await page
- .getByLabel('setting-LABEL_INLINE-wrapper')
- .locator('span')
- .nth(1)
- .click();
+ await page.getByText('Default label printer').waitFor();
await loadTab(page, 'Plugin Settings');
await page
@@ -238,7 +240,7 @@ test('Settings - Admin', async ({ browser }) => {
await page.getByText('Regex Search').waitFor();
await loadTab(page, 'Notifications');
await loadTab(page, 'Reporting');
- await page.getByText('Inline report display').waitFor();
+ await page.getByText('Default label printer').waitFor();
// System Settings
await page.locator('label').filter({ hasText: 'System Settings' }).click();