Problem displaying form data in print-templates - make variables from Master available in print-templates

As asked i make a new topic with my requirement and post some screenshots. Basically what i want is easy and works with many other variables/entries but for some reason this one makes problems. I have to say that i didnt setup the software, the company uses it since 1-2 years now and I just started 2 days ago here.

All the doctypes and fields were already setup, if right or not i cannot really tell at this time.

So now to the problem. I want to display Supplier Info, like tax_id and address in my print-template for Delivery Notes>Certificate of completion.

I have a doctype called “Supplier” (under module “Buying”), one called “Delivery Notes” (under Module “Stock”) and others of course but this are the ones i want to know now first about. The custom field “supplier_id_card_no” for Supplier was already created by other collegues. THen i tried to display this field in the mentioned template but it didnt display.
Then i made a post here and learned that i have to also make custom-fields for the other docs where i want to use this data. So i went ahead and created “supplier_id_card_no” also for the doctype “Delivery Notes” with datatype “read only” and input the options like “supplier.supplier_id_card_no” . Basically i made was is written here:

Also i was shown various ways to display this data in a template, like

{{ frappe.db.get_value(“[Supplier]”, “[supplier]”, "supplier_id_card_no ") }}


{{ doc.supplier_id_card_no }} (shows “none” as value)


{% set u = frappe.get_doc(“Supplier”, doc.supplier) %} Supplier Card No: {{ u.supplier_id_card_no }} (shows error “Supplier Supplier is unknown”)

I tried all of them in my template but none of them works. I get different problems/errors with them, either i get error that “Supplier Supplier” is unknown or i get the value “none” instead of the tax_id that the supplier has (for example).

THis is the page that shows the data of the supplier that is set to the document i want to print, so you can see that is has data (12345) in the field supplier_id_card_no

In my template the data is empty though. Or better said it shows “none” instead of the 12345


I went to check the doctype for Supplier (Doctypes > Supplier) and saw that no field is set here called "supplier_id_card_no ". Only the custom formfields are set but the following page here doesnt show the entry “supplier_id_card_no”. :

In the “Customize Form” page for Supplier i see them though:

Now i wonder, if i go to “Accounts > Supplier” and choose an entry for the supplier , it shows me the field for the Tax ID., even the Doctype doesnt have it in. How can this be? Whee ERPNext gets the fields that are seen here?

I tried to add a row but cannot insert any data? Any idea what i do wrong?
Btw, i also tried the fetch method in Custom Script for the Form Delivery Notes but nothing changes…

@Alex_Wolff if you can try this. It works for me…
{{ frappe.db.get_value(“Employee”, doc.sales_person, “employee_name”) }}