How to make "Expiry" default value in "Add batch Nos" form

Hello Everyone,

Is there a way to make “Expiry” the default value in the drop menu “fetch based on” in “Add batch Nos” form.

Thanks,
Deepak

Please set the default in below file.

Thank you very much @NCP . I am using erpnext hosted on frappe cloud so I don’t think I’ll be able to change the js file. Can it be done through form customization from the dashboard?

Not possible, but you can override it in your custom app.

Okay Nihantra! Thanks again for the information.

Hi @deepak19,

Which doctype do you want to set this?

Hi @NCP ,

I am using Sales Invoice. While adding a product, I want the “batch no.” to be fetched based on " Expiry" of the product instead of FIFO.

Okay, i have an option, first copy the whole code and paste it in the client script. and set the default value.

Output:

Test it on your according.

1 Like

Should I paste the code in the “your code section”
frappe.ui.form.on(‘Sales Invoice’, {
refresh(frm) {
// your code here
}
})

No, please check the video (end part), that i provide.

Thanks a lot @NCP . The code is working perfectly.