Customer name in Work Order custom print template

Hi Everyone,

I am trying to add the customer name in the work order for internal reasons but failed to do so.

I tried the following:

{% frm.add_fetch(‘sales_order’, ‘customer’, ‘your_custom_field_in_material_request_item_to_store_customer_name’); %}

Error: jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag ‘frm’.

{{sales_order.customer_name}}

Error: Jinja Template Error

Create a custom field called Customer Name in the Material Request Item Data type: Data (Same as the data type in the field in Sales Order In Options enter: sales_order.customer_name

and use {{doc.customer_name}} returns none.

any help is much appreciated

Jinja evaulates python and not javascript since it is rendered serverside.

You need to modify your code to use the python frappe api instead of JS.

solution in: