Fixed bug when subtabs works only in Items doctype

This commit is contained in:
Ali 2024-12-05 14:23:33 +04:00
parent bee51701cd
commit a77620953f
1 changed files with 7 additions and 7 deletions

View File

@ -3,8 +3,10 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
setTimeout(() => {
const tabs = this.wrapper.find("ul.form-tabs > li.nav-item");
const doctype = this.frm.doctype;
const hierarchy = frappe.boot.tab_hierarchy[doctype];
// Получение текущего Doctype в нижнем регистре
const currentDoctype = cur_frm.doctype;
const hierarchy = frappe.boot.tab_hierarchy[currentDoctype];
if (!hierarchy) {
return;
@ -18,7 +20,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
if (tabPane) {
tabPane.style.display = 'block';
tabPane.classList.add('active', 'show');
} else {
}
}
@ -47,12 +48,11 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
return;
}
// Show the subtabs for the parent tab
const parentSubtabs = subtabs[parentTabName] || [];
parentSubtabs.forEach((subtabName) => {
const subtabElement = $(`.nav-item:contains(${subtabName})`);
const subtabContentId = `item-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
const subtabContentId = `${currentDoctype.toLowerCase()}-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
const subtabContent = $(`#${subtabContentId}`);
if (subtabElement.length) {
@ -62,12 +62,12 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
if (subtabName === currentTabName) {
subtabContent.addClass("active show").css("display", "block");
}
} else {
}
});
// Show the parent tab's content
showTabContent(`item-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`);
const parentTabContentId = `${currentDoctype.toLowerCase()}-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
showTabContent(parentTabContentId);
// Recursively handle the parent tab
findParentAndShowSubtabs(parentTabName);