Merge pull request #24716 from shariquerik/form-builder-fixes-4

fix: redirect and open new doctype dialog if route to /doctype/new
This commit is contained in:
Shariq Ansari 2024-02-03 14:34:42 +05:30 committed by GitHub
commit 9f08b27991
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,8 +85,13 @@ export const useStore = defineStore("form-builder-store", () => {
async function fetch() {
doc.value = frm.value.doc;
if (doctype.value.startsWith("new-doctype-") && !doc.value.fields) {
doc.value.fields = [get_df("Data", "", __("Title"))];
if (doctype.value.startsWith("new-doctype-") && !doc.value.fields?.length) {
frappe.model.with_doctype("DocType").then(() => {
frappe.listview_settings["DocType"].new_doctype_dialog();
});
// redirect to /doctype
frappe.set_route("List", "DocType");
return;
}
if (!get_docfields.value.length) {