Item Safety Stock - Notification and Best Practices

Hi,
We’ve been working on this during a few months and we can’t find the best option to solve it.
We need that ERPNext send a notification when the stock level’s item reaches a certain level.
We’ve been trying with:

  • Auto generation of material request: It works, but we have several problems that this can’t solve.
  1. We are not interested in generating a doctype as a material request, in fact, it isn’t useful for some industries, ex. retail. We need just that ERPNext sent a notification to people with some role.
  2. The background process runs at midnight. It means that we have an entire day without any stock actualization, during which stock can exhaust.
  • Send a System Notification: It isn’t possible because there isn’t a doctype which works when stock item reaches certain level to link the notification (exactly what we need).
  • Create a Notification message: According to that post, Notification Message For Stock Shortage, we thought about the possibility to make a notification for doctypes related with stock movements that implies stock items reach under certain level.

Until now, write some lines of code to make a quantity control and send a notification message (if it corresponded) related with the submit of some stock doctype seems to be the only way to solve this, but we are not sure about that.
So, we’re looking for options to notificate system users with some specific role when stock item is really low, and it would be important that it could be in real time.
We understood that it’s an important background job, so it can’t be executed all day long, but just one time a day it isn’t enough.

Did anybody find another way to do this?
How manage this retail firms, or some industries more like JIT?

Thanks in advance,

2 Likes

You can write a custom background job and increase it’s frequency to run every 30 mins or so and see if it works for you.

Hi @Pawan, thanks for your suggestion.
Do you know firms that have increased the frequency? Is that the best solution?
We thought about that, but we were in doubt because constant background job might be inconvenient, specially in rush hour…

It depends on the volume of data you have, you could try it on a test server (do some performance tuning) before putting it out in a live environment.

Ok, but it doesn’t solve the problem that we don’t want a material request… We just need to know when items are under safety stock. It doesn’t seems like the best solution, but I will have it in mind.
Thanks.

Sure, if you do find the solution please share.

can u plz help me sir?

What about “Auto Email Report” feature. You can create a report which lists items that are under safety stock. Then you can use “Auto Email Report” feature.

1 Like

Hi @TurkerTunali, thanks for the suggestion! I will try. But doesn’t solve the time between stock changes and notification… Because of that I’d like to know how retails do, grocery store… However, thanks again!

I understand you want a more real time notification.

Do you have a custom app installed ?

One idea off the top of my head (not tested) would be to define an after_save doc event in hook.py for the Bin doctype.
https://frappeframework.com/docs/user/en/python-api/hooks#crud-events
I understand the Bin doctype holds a snapshot of the actual qty, so you could do your actual stock validation each time it is updated by the system.

1 Like

@guimorin Good idea! The obstacle is the limit of the server, but i will have it in mind.Thanks!

how to write the script for that?

Did you find any solution for this ?

Its late reply. But I think its 3 step solution can work:

  1. create custom field of bool in bin docType e.g notify_stock
  2. create server script of after_save with following check:
    if doc.actual_qty< frappe.db.get_value(‘Item’,{‘item_code’:doc.item_code}, [‘safety_stock’]):
    notify_stock=True
  3. Create notification on bin DocType for value Change on notify_stock field with condition of notify_stock==True , send email or other kind of notification
1 Like