InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

stock expiry email notifications

Open ukawsecurity opened this issue 1 year ago • 5 comments

Please verify that this feature request has NOT been suggested before.

  • [X] I checked and didn't find a similar feature request

Problem statement

i am looking to get an email when a stock item expires or goes stale.

Suggested solution

if a stock item was able to be auto depleted upon expiry this would work as it would show the item as out of stock. however this would only work if the part went below the minimum stock level

Describe alternatives you've considered

it may also be possible to achieve this by adding an element that detects when the stale stock level goes over say a value of 1.

Examples of other systems

i dont know any other systems that do this

Do you want to develop this?

  • [ ] I want to develop this.

ukawsecurity avatar Aug 13 '24 10:08 ukawsecurity

@ukawsecurity thanks for raising the issue. This could certanly be implemented by extending our current notifications scheme. Would your company be willing to fund development of this issue?

SchrodingersGat avatar Aug 13 '24 11:08 SchrodingersGat

what sort funding is required?

ukawsecurity avatar Aug 31 '24 19:08 ukawsecurity

@ukawsecurity any contributions would be appreciated - there is not a fixed level of funding, but the more funding against an issue, the more likely it is going to attract priority attention from a developer! Some issues receive funding from multiple interested companies / individuals, which helps!

This particular feature I would estimate to take ~5-10 hours of development.

SchrodingersGat avatar Sep 14 '24 01:09 SchrodingersGat

This issue seems stale. Please react to show this is still important.

github-actions[bot] avatar Nov 13 '24 11:11 github-actions[bot]

Hey @ukawsecurity are you still interested in this?

SchrodingersGat avatar Nov 20 '24 06:11 SchrodingersGat

@SchrodingersGat

I am looking for the same: I want to receive an email when a stock item expired. I would like to try to implement this feature. Not sure if I will succeed however ;)

Here is my concept:

  1. Introduce a new part field "expire_notify_days" where one can enter the days prior a notification shall be sent before expire.
  2. Show field only if expire toggle in settings in true (like the default expiry field)
  3. Setting field to 0 -> no notifications are sent if a stock item of this part expires
  4. implement a scheduled daily task(*): cycling through all stock items and collect those where condition is true: now() > stock_item:expire_date - part:expire_notify_days
  5. Use the already implemented email notification system (*) to send a templated email

(*) no clue yet, how this is implemented in inventree, but willing to find out.

Is this a way to go?

gitbock avatar Jun 22 '25 08:06 gitbock

I am not sure we should extend the part model for this, this sounds like a global setting should cover most use cases and reduce model data and logic complexity.

matmair avatar Jun 22 '25 08:06 matmair

Fair point.

Was thinking of flexibility:

  1. You may be interested in notifications only for some expiring parts not all.
  2. Some parts could have a longer delivery time you want to watch out for; let's say the shipping of part X needs 4 weeks; I want to be notified at least 5 weeks before. But for part Y the shipping only takes 1 week, so a pre notification of 2 weeks is sufficient.

gitbock avatar Jun 22 '25 08:06 gitbock

We already have such a setting, the STOCK_STALE_DAYS determines how many days (before it is "expired") a stock item is considered "stale".

Sending out a notification when stock becomes stale should not be too difficult based on a simple daily scheduled task

SchrodingersGat avatar Jun 22 '25 23:06 SchrodingersGat

Thanks for your advises. OK, then let me try to implement the notification based on the STOCK_STALE_DAYS setting 👍

gitbock avatar Jun 23 '25 05:06 gitbock