From b0e7dcd8c04702c5794152a5bffba92cd178fa16 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Thu, 5 Dec 2024 14:36:14 +0400 Subject: [PATCH] Fixed bug when subtabs won't work in doctype with seperate name --- custom_subtabs/public/js/custom_subtabs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_subtabs/public/js/custom_subtabs.js b/custom_subtabs/public/js/custom_subtabs.js index 2bff563..84e0a70 100644 --- a/custom_subtabs/public/js/custom_subtabs.js +++ b/custom_subtabs/public/js/custom_subtabs.js @@ -52,7 +52,7 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () { const parentSubtabs = subtabs[parentTabName] || []; parentSubtabs.forEach((subtabName) => { const subtabElement = $(`.nav-item:contains(${subtabName})`); - const subtabContentId = `${currentDoctype.toLowerCase()}-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`; + const subtabContentId = `${currentDoctype.toLowerCase().replace(/\s+/g, '-')}-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`; const subtabContent = $(`#${subtabContentId}`); if (subtabElement.length) { @@ -66,7 +66,7 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () { }); // Show the parent tab's content - const parentTabContentId = `${currentDoctype.toLowerCase()}-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`; + const parentTabContentId = `${currentDoctype.toLowerCase().replace(/\s+/g, '-')}-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`; showTabContent(parentTabContentId); // Recursively handle the parent tab