This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here, Supplier DocType Contains a custom field (readonly) Called "UID". | |
// This feild is auto populated with the next number based on the highest UID in the supplier table. | |
frappe.ui.form.on("Supplier", { | |
validate: function(frm) { | |
if(frm.doc.__islocal == '1'){ | |
frappe.db.get_list("Supplier", {fields:'uid', order_by:"uid desc",limit:1}).then((data) => { | |
frm.set_value("uid",String(parseInt(data[0].uid)+1).padStart(5,'0')); | |
}); | |
} |