fix: Custom dashboard sections
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
index 699eb08..08e30b5 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
@@ -101,7 +101,8 @@
frappe.render_template('opening_invoice_creation_tool_dashboard', {
data: opening_invoices_summary,
max_count: max_count
- })
+ }),
+ __("Opening Invoices Summary")
);
section.on('click', '.invoice-link', function() {
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool_dashboard.html b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool_dashboard.html
index 5b136d4..afbcfa5 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool_dashboard.html
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool_dashboard.html
@@ -1,4 +1,3 @@
-<h5 style="margin-top: 0px;">{{ __("Opening Invoices Summary") }}</h5>
{% $.each(data, (company, summary) => { %}
<h6 style="margin: 15px 0px -10px 0px;"><a class="company-link"> {{ company }}</a></h6>
diff --git a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
index 001fc26..70b8654 100644
--- a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
+++ b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.js
@@ -40,14 +40,13 @@
if(!r.message) {
return;
}
- var section = frm.dashboard.add_section(`<h5 style="margin-top: 0px;">
- ${ __("Maintenance Log") }</a></h5>`);
+ const section = frm.dashboard.add_section('', __("Maintenance Log"));
var rows = $('<div></div>').appendTo(section);
// show
(r.message || []).forEach(function(d) {
$(`<div class='row' style='margin-bottom: 10px;'>
<div class='col-sm-3 small'>
- <a onclick="frappe.set_route('List', 'Asset Maintenance Log',
+ <a onclick="frappe.set_route('List', 'Asset Maintenance Log',
{'asset_name': '${d.asset_name}','maintenance_status': '${d.maintenance_status}' });">
${d.maintenance_status} <span class="badge">${d.count}</span>
</a>
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index d62e418..9ccb915 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -75,7 +75,8 @@
frm.dashboard.add_section(
frappe.render_template('leave_application_dashboard', {
data: leave_details
- })
+ }),
+ __("Allocated Leaves")
);
frm.dashboard.show();
let allowed_leave_types = Object.keys(leave_details);
diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
index d30e3b9..6324b04 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
+++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
@@ -1,6 +1,5 @@
{% if not jQuery.isEmptyObject(data) %}
-<h5 style="margin-top: 20px;"> {{ __("Allocated Leaves") }} </h5>
<table class="table table-bordered small">
<thead>
<tr>
diff --git a/erpnext/stock/doctype/batch/batch.js b/erpnext/stock/doctype/batch/batch.js
index e2ea7f9..71a3e7a 100644
--- a/erpnext/stock/doctype/batch/batch.js
+++ b/erpnext/stock/doctype/batch/batch.js
@@ -47,8 +47,7 @@
return;
}
- var section = frm.dashboard.add_section(`<h5 style="margin-top: 0px;">
- ${ __("Stock Levels") }</a></h5>`);
+ const section = frm.dashboard.add_section('', __("Stock Levels"));
// sort by qty
r.message.sort(function(a, b) { a.qty > b.qty ? 1 : -1 });
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 38e5fe5..e07e653 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -380,8 +380,7 @@
// Show Stock Levels only if is_stock_item
if (frm.doc.is_stock_item) {
frappe.require('assets/js/item-dashboard.min.js', function() {
- var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">\
- <a href="#stock-balance">' + __("Stock Levels") + '</a></h5>');
+ const section = frm.dashboard.add_section('', __("Stock Levels"));
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
parent: section,
item_code: frm.doc.name