Customer's Purchase Order in Credit Note - Jinja Tag

We have a custom print format for Credit Notes because we require that our original sales invoice against which the credit is being issued is printed. This of course can be done by choosing the Credit Note Against Sales Invoice element from the sidebar in the Print Format Builder.

However, we also need to print the Customer’s Purchase Order on the Sales Invoice that the credit note is being issued against.

I tried using the jinja tag {{ doc.return_against.po_no }} thinking that it would fetch the po_no value from the doc.return_against Sales Invoice but we get the following output: {{ no such element: unicode object[‘po’] }}.

Any ideas how this can be achieved? Thank you!

Have you tried {{ doc.po_no }} ? Just a thought because I still am not understanding which Doctype data is pasted on doc variable .

{{ doc.po_no }} will not work because that refers to the PO for the current document, not the one the return is made against.

For instance, say we have SINV-0001 with Customer’s PO Number 123. Say we then create a credit note against SINV-0001 and the credit note is SINV-0002. When we try to print SINV-0002, the tag {{ doc.po_no }} will return None and {{ doc.return_against }} will return SINV-0001. If we try to print SINV-0001, then {{ doc.po_no }} will returm 123.