Fetch Salesperson name in print format

I want to fetch the Sales person in the Sales invoice print format. I tried the below code using custom HTML in print format. What am I doing wrong?

{{ doc.sales_person }}

In the Sales Invoice, Sales Persons are updated in the child table, like Item master. Please add the Sales Persons table in the Print Format, and then check fields to be shown in the Print Format. For the reference, check how fields are added in the Sales Invoice Item table.

To be honest, the Sales persons table looks an odd man out. Please see the print screen below. To counter the bad formatting, I want to fetch the sales person name (without the table) and then display it in a similar format to ‘Sale type’.

I found something and it works. Hope this is the correct method.

{%- for row in doc.sales_team -%}
{{ row.sales_person }}<br>
{%- endfor -%}
1 Like

Where should like add his code?

Thanks

Have you figured out where to paste this code?