1
0
forked from test/crm

fix: added this.meta

(cherry picked from commit 5fcd447bc87b2d3cf40dd3fdbf1c9126a7c8373e)
This commit is contained in:
Shariq Ansari 2025-05-07 12:13:56 +05:30 committed by Mergify
parent 53a9fedb0d
commit 39e7f349a2

View File

@ -1,4 +1,5 @@
import { globalStore } from '@/stores/global'
import { getMeta } from '@/stores/meta'
import { createToast } from '@/utils'
import { call, createListResource } from 'frappe-ui'
import { reactive } from 'vue'
@ -79,6 +80,8 @@ export function getScript(doctype, view = 'Form') {
let parentInstance = null
let doctypeName = doctype.replace(/\s+/g, '')
let { doctypeMeta } = getMeta(doctype)
// if className is not doctype name, then it is a child doctype
let isChildDoctype = className !== doctypeName
if (isChildDoctype) {
@ -87,6 +90,7 @@ export function getScript(doctype, view = 'Form') {
controllers[className] = setupFormController(
FormClass,
doctypeMeta,
document,
parentInstance,
isChildDoctype,
@ -102,6 +106,7 @@ export function getScript(doctype, view = 'Form') {
function setupFormController(
FormClass,
meta,
document,
parentInstance = null,
isChildDoctype = false,
@ -114,6 +119,14 @@ export function getScript(doctype, view = 'Form') {
}
}
instance.getMeta = async (doctype) => {
if (!meta[doctype]) {
await getMeta(doctype)
return meta[doctype]
}
return meta[doctype]
}
if (isChildDoctype) {
setupHelperMethods(FormClass, instance, document)
instance.doc = createDocProxy(document.doc, parentInstance)