Server Side Script to update field


What I am trying to achieve :

When Batch Quantity become 0 (because of delivery note or manufacture entry) set it as disabled.

I am trying to do it with a server side script :

if "0" in doc.batch_qty:
    doc.disabled = "1"

I am getting this error message :


I am basing this on ERPNExt documentation :

Am I missing something?

Thank you!

Hi @FredericVerville,

Please use it like.

Script Type: “Before Save”

if doc.batch_qty == 0:
    frappe.msgprint("Your Message Here")

Please set your according value set after if condition.
Thank You!