Update stock bug in the sales invoice

I have customize the sales invoice update stock check box as mandatory to avoid being not selecting by users and course stock updating problem.

But user can submit sales invoice without click on update stock even I customize this click box as mandatory.

Where do I miss?

Hey tried this with not with a sales invoice but with a different form. I too was able to submit it without setting a check mark I made mandatory

Meanwhile you can use a custom script on event validate, if the Update Stock check mark is not 1 you throw an exception and prevent it from submission

How to do that?

Try this

frappe.ui.form.on("Sales Invoice",{
    validate: function(frm){
                frappe.throw("Update Stock is unchecked")

Check if that field is called update_stock or something else. Just replace it by the correct field name

Why is not coming as default in ERP next?

earlier It was works fine.

Make the ‘Update Stock’ field read only and set the Default value to 1.