fix(ux): set entries qty to 1 before making the field read-only

This commit is contained in:
s-aga-r 2023-06-09 12:06:46 +05:30
parent 1d904c0a86
commit 1f28ca717e

View File

@ -127,6 +127,14 @@ frappe.ui.form.on('Serial and Batch Bundle', {
},
toggle_fields(frm) {
if (frm.doc.has_serial_no) {
frm.doc.entries.forEach(row => {
if (Math.abs(row.qty) !== 1) {
frappe.model.set_value(row.doctype, row.name, "qty", 1);
}
})
}
frm.fields_dict.entries.grid.update_docfield_property(
'serial_no', 'read_only', !frm.doc.has_serial_no
);