Check against document links using Jinja

hi everyone,

i wounder how i could check if one document have a link to another document or not using jinja template?

example: if i need to tell jinja if this sales order have a delivery note to it then print the delivery note number / info…

Thanks in advance…

you can use frappe.db.get_value in jinja

@ramielian please don’t @-mention someone in a general query. There are many more people who would then not answer.

@rmehta sorry about that…

how can i use frappe.db.get_value?
i checked the BD using phpmyadmin but i didnt see anything relating to links in the doc…

@ramielian You can write following query to get value in another doctype


frappe.db.get_value("[doctype]", "[name]", "fieldname")

e.g. to fetch customer group from customer in Sales Invoice.

{{ frappe.db.get_value("Customer", doc.customer,"customer_group") }}
1 Like

@kolate_sambhaji what i meant i need to check like in my case against if have delivery note against sales order or sales invoice, and if have need information from that delivery note…

@ramielian Sales Order number is stored into Delivery Note Item table.
Using that you can write code to track document.

1 Like