From ea88451875e802a47d3e46e4dbcca33c1278662c Mon Sep 17 00:00:00 2001 From: HarryPaulo Date: Wed, 3 Aug 2022 02:51:30 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20getting=20error=20to=20show=20sales=20in?= =?UTF-8?q?voice=20group=20or=20print=20rep=E2=80=A6=20(#31756)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: formatter getting error to show sales invoice group or print report. 1 - When I view the Gross Profit report in Sales Invoice mode, the table is all broken. Error on browser console: TypeError: Cannot read properties of undefined (reading 'indent') 2 - When I try to print, no matter the Group (Sales Invoice, Item Code, Item Group...) nothing happens. in browser log console I have the following error: TypeError: Cannot read properties of undefined (reading 'content') i fixed both errors and all working perfectly. --- erpnext/accounts/report/gross_profit/gross_profit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js index 3d37b5898c1..21205c31634 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.js +++ b/erpnext/accounts/report/gross_profit/gross_profit.js @@ -44,14 +44,14 @@ frappe.query_reports["Gross Profit"] = { "parent_field": "parent_invoice", "initial_depth": 3, "formatter": function(value, row, column, data, default_formatter) { - if (column.fieldname == "sales_invoice" && column.options == "Item" && data.indent == 0) { + if (column.fieldname == "sales_invoice" && column.options == "Item" && data && data.indent == 0) { column._options = "Sales Invoice"; } else { column._options = "Item"; } value = default_formatter(value, row, column, data); - if (data && (data.indent == 0.0 || row[1].content == "Total")) { + if (data && (data.indent == 0.0 || (row[1] && row[1].content == "Total"))) { value = $(`${value}`); var $value = $(value).css("font-weight", "bold"); value = $value.wrap("

").parent().html();