fix(client-script): fix redirect issue in single doctype

This commit is contained in:
Kaviraj 2026-01-08 11:53:34 +05:30
parent f05cac5874
commit 9fcaaa97b0

View file

@ -8,13 +8,24 @@ frappe.ui.form.on("Client Script", {
frappe.utils.highlight_pre(sample_field.$wrapper);
},
refresh(frm) {
if (frm.doc.dt && frm.doc.script) {
frm.add_custom_button(__("Go to {0}", [frm.doc.dt]), () =>
frappe.set_route("List", frm.doc.dt, "List")
);
}
if (frm.doc.dt && frm.doc.script) {
frm.add_custom_button(__("Go to {0}", [frm.doc.dt]), () => {
frappe.db.get_value(
"DocType",
frm.doc.dt,
"issingle"
).then(r => {
if (r && r.message && r.message.issingle) {
frappe.set_route("Form", frm.doc.dt);
} else {
frappe.set_route("List", frm.doc.dt);
}
});
if (frm.doc.view == "Form") {
});
}
if (frm.doc.view == "Form") {
frm.add_custom_button(__("Add script for Child Table"), () => {
frappe.model.with_doctype(frm.doc.dt, () => {
const child_tables = frappe.meta