Dashboard on custom app


I’ve created custom app called klienti with doctype klienti and app called intervence with doctype intervence. I’ve created klienti_dashboard.py with this:

from __future__ import unicode_literals

from frappe import _

def get_data():
	return {
		'fieldname': 'klienti',
    'transactions': [
                'label': _('Intervence'),
                'items': ['Intervence']

But when I open doctype klienti, I get this error:

Traceback (most recent call last):
  File "/home/edok/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/home/edok/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/edok/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/edok/frappe-bench/apps/frappe/frappe/__init__.py", line 1036, in call
    return fn(*args, **newargs)
  File "/home/edok/frappe-bench/apps/frappe/frappe/desk/notifications.py", line 288, in get_open_count
    filters={fieldname: name}, limit=100, distinct=True, ignore_ifnull=True))
  File "/home/edok/frappe-bench/apps/frappe/frappe/__init__.py", line 1293, in get_all
    return get_list(doctype, *args, **kwargs)
  File "/home/edok/frappe-bench/apps/frappe/frappe/__init__.py", line 1266, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
  File "/home/edok/frappe-bench/apps/frappe/frappe/model/db_query.py", line 94, in execute
    result = self.build_and_run()
  File "/home/edok/frappe-bench/apps/frappe/frappe/model/db_query.py", line 122, in build_and_run
    return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
  File "/home/edok/frappe-bench/apps/frappe/frappe/database.py", line 214, in sql
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
  File "/home/edok/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, "Unknown column 'tabIntervence.klienti' in 'where clause'")

Dashboard is displayed but it seem to not working as expected. When I click on Intervence, I see all records in Intervence, not just for this record (I’ve created link in intervence doctype to klienti doctype). When I try to add new record to intervence, link is correctly filled.

Do you have any ideas what I’m doing wrong?

paste your link field in

please paste the screen shot of the field definition in doctype

This is screen of the field which is linked to Klienti doctype, where I need to display the dashboard.

Thanks :slight_smile:

from future import unicode_literals

from frappe import _

def get_data():
return {
‘fieldname’: ‘intervence_klienti’,
‘transactions’: [
‘label’: _(‘Intervence’),
‘items’: [‘Intervence’]

the field name to map the fieldname in doctype definition as above

Thanks, my mistake :slight_smile: It’s working now.

is there any need call dashboard.py file if yes where?

Where to add file name in hooks.py ?