From c441c844f9ef4c4e1b9c30293a1e88b4ce226f9d Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Mon, 11 Mar 2024 19:34:53 +0530 Subject: [PATCH] fix(auto_email_report): check if column (docfield) parent is a child table (#25335) This code tried to fetch the child doctype with the parent's ID otherwise Support ticket 11145 Signed-off-by: Akhil Narang Co-authored-by: Ankush Menat --- frappe/email/doctype/auto_email_report/auto_email_report.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.py b/frappe/email/doctype/auto_email_report/auto_email_report.py index 96c7d10d8f..558a1eeb3d 100644 --- a/frappe/email/doctype/auto_email_report/auto_email_report.py +++ b/frappe/email/doctype/auto_email_report/auto_email_report.py @@ -345,7 +345,9 @@ def make_links(columns, data): if col.options and row.get(col.options): row[col.fieldname] = get_link_to_form(row[col.options], row[col.fieldname]) elif col.fieldtype == "Currency": - doc = frappe.get_doc(col.parent, doc_name) if doc_name and col.get("parent") else None + doc = None + if doc_name and col.get("parent") and not frappe.get_meta(col.parent).istable: + doc = frappe.get_doc(col.parent, doc_name) # Pass the Document to get the currency based on docfield option row[col.fieldname] = frappe.format_value(row[col.fieldname], col, doc=doc) return columns, data