Showing login username on print

i have created one custom field named “Approved by” on Material request, is it possible to make this field dynamically read who login to the system and automatically show his name on this field,…the purpose is when we print this document it will show who approned it.the printed document is usefull for audit purpose.

Try this in your print format:

{{ frappe.session.user }}

@tmatteson
thanks for your quick replay…it works but in our scenario…the approver will be the manager who have the privilege but the one who prinnt the document will be the requister or other employee…so is it possible to show the approver only?thanks in advance

{{ doc.approved_by }}

1 Like

@tmatteson thanks again shall i give this script on cutom report builder or shall i give it on custom field?thanks

This goes into the print format for the document you are printing.
Print formats are written in templating language called Jinja2, which is a mishmash of python and HTML.