Help Needed | Print format with frappe.db.get_value (Unknown column)

Hi Everyone.

I am doing a customized print format for the sales order, and my company requires the BOM items to be available in the sales order print out.

I am trying to use the default BOM from the sales order items to get the items, but for now, it’s still not working.

what I have done is:

{% set bItem = frappe.db.get_value(‘BOM’, row.default_bom, ‘items’ ) %}
{% for bI in bItem %}
{{ bI.item_name }}
{% endfor %}

but I got an error:

pymysql.err.InternalError: (1054, “Unknown column ‘items’ in ‘field list’”)

Any help is much appreciated

after researching a bit more i found many have the same issue, another solution I am thinking of is querying the DB directly, but also not working for me :frowning:

this is my code:

		{% 	set data= frappe.db.sql(" SELECT * FROM `tabBOM Item` 
	where parent = (%s);",(row.default_bom))	%}

TypeError: 'NoneType' object is not callable

Any help ?