fix: only allow one default priority in priorities table
This commit is contained in:
parent
cb0e3e3171
commit
5454a4f8e5
@ -1,8 +1,18 @@
|
||||
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("CRM Service Level Agreement", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
frappe.ui.form.on("CRM Service Level Agreement", {
|
||||
validate(frm) {
|
||||
let default_priority_count = 0;
|
||||
frm.doc.priorities.forEach(function (row) {
|
||||
if (row.default_priority) {
|
||||
default_priority_count++;
|
||||
}
|
||||
});
|
||||
if (default_priority_count > 1) {
|
||||
frappe.throw(
|
||||
__("There can only be one default priority in Priorities table")
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user