Email alerts error?

I have put this on gitub, but just in case I am doing somethign wrong and someone can point me in the right direction

We have set up an email alert to email when the projected quantity of a product is less than the safety stock as shown here


Two problems

  1. Ideally we should be able to also select the Re-Order level rather than stock level
  2. If the projected quantity is less than 0 it does not seem to work. We have a product with a projected quanitty of -178 and a safeyty stock of 200 but the email was not generated
1 Like


I think document type should be “delivery note”. Please try it.


Why would it be delivery note? We are not creating delivery notes at this point. This is to alert production that we are short of stock when an order is placed. In fact some orders we will not use delivery notes any way (direct sales invoice)

Ok. Actually I have tested email alert for document type delivery note & sales invoice. They are working fine but have not tested this scenario.

Yes, I tested yesterday with different scenarios and it worked so I was suprised when it did not for this particular item. The only thing I can think of is that the negative projected quantity is causing an issue (as in two minuses making a plus kind of way)

Yes, may be a case.

I think you can check it by using abs(projected qty) in condition.

No, it does not like adding ABS -says it is invalid

Did you try without doc in condition.

total_projected_qty <= safety_stock

It has to have the doc. otherwise it throws an error

Try eval(doc.total_projected_qty <= doc.safety_stock)

No, same message

The Condition ‘eval(doc.total_projected_qty <= doc.safety_stock)’ is invalid

Thanks for trying

any solutions for this?