Dashboard error: OperationalError 1054

Hello;

I need to place dashboard for the document type Trip Order which is under this path:

/home/frappe/frappe-bench/apps/taxi/taxi/taxi/doctype/trip_order$

The dashboard is appearing but it gives me this error:

OperationalError: (1054, “Unknown column ‘tabSales Invoice.trip_order’ in ‘where clause’”)

Below is the file trip_order_dashboard.py:

from frappe import _

def get_data():
return {
‘fieldname’: ‘trip_order’,
‘transactions’: [
{
‘label’: _(‘Fulfillment’),
‘items’: [‘Sales Invoice’, ‘Delivery Note’]
},
{
‘label’: _(‘Purchasing’),
‘items’: [‘Material Request’, ‘Purchase Order’]
},
{
‘label’: _(‘Projects’),
‘items’: [‘Project’]
},
{
‘label’: _(‘Manufacturing’),
‘items’: [‘Production Order’]
},
{
‘label’: _(‘Reference’),
‘items’: [‘Quotation’, ‘Subscription’]
},
{
‘label’: _(‘Payment’),
‘items’: [‘Payment Entry’, ‘Payment Request’, ‘Journal Entry’]
},
]
}

Well, if I removed:

‘fieldname’: ‘trip_order’

Which is relate to the filter, then no error appears, but when I click on Sales Invoice at the dashboard to see the sales invoices related to this trip order, it takes me to the sales invoice list without any filter (of course, because I removed the ‘fieldname’: ‘trip_order’).

I am sure that I am missing something to be placed.
Thanks for the help.

Regards
Bilal

Have you created field “trip_order” in Sales Invoice?

1 Like

Thanks a lot for your kindly reply.
No I did not.
But i checked sales invoice and I did not find sales_order field, so how the dashboard is working there?
Regards
Bilal

@Pawan
Yes if I added the field “trip_order” in Sales Invoice, the problem is resolved.
Another solution (and that is what happened between sales order and sales invoice): if I added the trip order to the internal_links in the sales_invoice_dashboard.py then it is working fine.
So the field is a direct link and the internal_links is indirect link through the common child table.
Regards
Bilal