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 <me@akhilnarang.dev>
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
Akhil Narang 2024-03-11 19:34:53 +05:30 committed by GitHub
parent 8a3dd85503
commit c441c844f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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