How to Display Workflow Approver Details in Sales Invoice Print Format?

Hi everyone,

I’ve implemented a workflow for the Sales Order doctype in ERPNext to manage an approval process. Everything is working fine functionally, but I would like to show the approver’s details (such as who approved the order and when) in the Print Format of the Sales Order.

Is there a way to fetch and display this information using Jinja or any other method in a custom print format?

@Sanmugam you can use the below code this will fetch the latest workflow action from the current document
Note: If you want to show only when its approved then you can add one more filter in workflow action “status”: “Completed”

{%- set actions = frappe.db.get_value("Workflow Action",{
        "reference_doctype": doc.doctype,
        "reference_name": doc.name,
    }, 
    ["user", "creation", "status"], as_dict=1
    )
-%}

{%- if actions -%}
    <p><strong>{{doc.workflow_state}} By:</strong> {{ frappe.get_fullname(actions.user) }} on {{ actions.creation.strftime("%Y-%m-%d %H:%M") }}</p>
{%- else -%}
    <p><strong>Status:</strong> Not yet approved</p>
{%- endif -%}