From 39e7f349a245c3524eb72b9275fb94d8c4c1936b Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 7 May 2025 12:13:56 +0530 Subject: [PATCH] fix: added this.meta (cherry picked from commit 5fcd447bc87b2d3cf40dd3fdbf1c9126a7c8373e) --- frontend/src/data/script.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/src/data/script.js b/frontend/src/data/script.js index 4d917e15..f4bbbdad 100644 --- a/frontend/src/data/script.js +++ b/frontend/src/data/script.js @@ -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)