fix(client-script): fix redirect issue in single doctype
This commit is contained in:
parent
f05cac5874
commit
9fcaaa97b0
1 changed files with 17 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue