* Add stale stock email notifications Implement automated email notifications for stock items approaching their expiry dates. Users receive consolidated daily emails for all their subscribed parts that are within the configured stale threshold. Fixes #7866 * Fix for tracing init (#9860) - Circular include means that settings.DB_ENGINE may not be available * [bug] Custom state fix (#9858) * Set status correctly when returning from customer * Fix for stock item status change - Reduced set of changes from #9781 * Handle API updates * Fix variable shadowing * More intelligent comparison * Remove debug statement * fix syntax again (#9863) * fix(backend): change notification for INVE-W10 (#9864) implements changes requested in https://github.com/inventree/InvenTree/pull/9769#issuecomment-3004193476 * Tweak for tracing setup (#9865) - DB_ENGINE is of the form "django.db.backends.postgresql", not "postgesql" * Update README.md (#9867) Update sponsors list * Remove sleep call (#9866) * New Crowdin translations by GitHub Action (#9813) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Table default cols (#9868) * Work in progress - Seems to reset the columns on page refresh - Probably related to the useLocalStorage hook * Do not overwrite until the tablestate is loaded * Prevent table fetch until data has been loaded from localStorage * Improved persistance * Adjust default column visibility * Adjust playwright test * Clear data tweak (#9870) * Tweaks for config path checks * Update delete-data task * Tweaks for config path checks (#9869) * fix instrumentation code (#9872) * [UI] About tweak (#9874) * Cleanup server info modal * Sort package info * De-sync useLocalStorage (#9873) * [UI] Fix thumbnail rendering (#9875) - Fix typo which caused full image to be rendered - This could cause significant network loading time * Add stale stock email notifications Implement automated email notifications for stock items approaching their expiry dates. Users receive consolidated daily emails for all their subscribed parts that are within the configured stale threshold. Revert django.po Fixes #7866 * fixed pull request issues #9875) * unit test notifications for stale stock items --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com> Co-authored-by: Matthias Mair <code@mjmair.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
4.5 KiB
title
| title |
|---|
| Stock Expiry |
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:
{{ image("stock/enable_stock_expiry.png", title="Enable stock expiry feature") }}
!!! info "Non Expiring Stock" If a Stock Item is not expected to expire, leave the expiry date field blank, or zero
Add Expiry Date
When creating a new stock item, the expiry date can be manually set by the user.
{{ 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") }}
The expiry date can be adjusted in the stock item edit form.
{{ image("stock/expiry_date_edit.png", title="Edit 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.
{{ image("stock/stock_table_expiry.png", title="Filter by stock expiry") }}
Index Page
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.
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.
!!! info "Non Expiring Parts" If a part is not expected to expire, set the default expiry time to 0 (zero) days.
If a Part has a non-zero default expiry time, it will be displayed on the Part details page
{{ image("stock/part_expiry_display.png", title="Display part expiry") }}
The Part expiry time can be altered using the Part editing form.
{{ image("stock/part_expiry.png", title="Edit part expiry") }}
Stale Stock Notifications
InvenTree can automatically notify users when stock items are approaching their expiry dates. This feature helps prevent stock from expiring unnoticed by providing advance warning.
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".
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
How It Works
The system runs a daily background task that:
- Checks for stale stock: Identifies stock items with expiry dates within the configured threshold
- Groups by user: Organizes stale items by users who are subscribed to notifications for the relevant parts
- Sends consolidated emails: Each user receives a single email containing all their stale stock items
Prerequisites
For stale stock notifications to work:
- Stock expiry must be enabled: The
STOCK_ENABLE_EXPIRYsetting must be enabled - Stale days configured: The
STOCK_STALE_DAYSsetting must be greater than 0 - Email configuration: Email settings must be properly configured
- 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:
- Navigate to the part detail page
- Click the notification bell icon to subscribe
- Users can also subscribe to entire part categories
For more information on part subscriptions, see the Part Notifications 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") }}