I currently have a web page that displays a table of customers and their respective orders, and what I want to do is write a function that simply calculates the sum of the prices of all items in an order.
Where do I write such a function? The web page was created in the www folder along with its respective Python file.
Also, running frappe.get_all() in get_context() to fetch all DocTypes of one type is not yielding anything.
def get_orders():
orders = frappe.get_all('Order')
for d in orders:
p = frappe.get_doc('Order', d)
# for first_name -> p.first_name
# p.last_name
# p.order
If order field had multiple entries or maybe was a child table of āOrderā then maybe you can iterate
I already tried entering my own functions in orders.py but have been unable to call them in orders.html via Jinja. Plus, frappe.get_all just aināt working for some reasonā¦
Try this, in your terminal type ābench consoleā and hit enter. It should open up a bench console. In that type āfrappe.get_all(āOrderā)ā , this should fetch and return all the Order
Any solutions to this. I am experiencing the same thing.
When calling the frappe.get_all() method in python it has troubles fetching child tables.
If I specify certain fields with the field parameter like frappe.get_all('Project', filters={'status': 'Open'}, fields=['name', 'description']) it returns data. As soon as I add a child table field to the field list the complete result is empty.