Wednesday 9 September 2015

display current logged in user name and data in ERPNext/Frappe Print Format

<!-- TO print current logged in user email id -->
<div class="row">
    <div class="col-xs-5 text-right"><big><b>Print By(email id)</b>  </big></div>
    <div class="col-xs-7 "><big>{{ frappe.user }} </big> </div>
</div> 

<!-- TO print current logged in user fist name -->
{% set u = frappe.get_doc("User", frappe.user) %} 
<div class="row">
    <div class="col-xs-5 text-right"><big><b>Print By(user name)</b>  </big></div>
    <div class="col-xs-7 "><big>{{ u.first_name }} </big> </div>
</div>

3 comments:

  1. This is great but, How do I insert this? I tried an HTML custom field on a doctype but it didnt work..Thanks!

    ReplyDelete
    Replies
    1. This code will print current logged in user in print format, no need to add custom field.
      https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/print-format.html

      Delete
  2. works like a charm...thanks!

    ReplyDelete