Customize Connections links

Hi guys,

I have been trying to modify these links under Connections. Where can i edit these links?

1 Like

In there you find “link documents”.

i want to remove the default ones. these are not defined there

1 Like

Hi Erik,

The only way I know is modifying the related Python code.

This is the path to the file for Patient Appointments:

from __future__ import unicode_literals
from frappe import _

def get_data():
	return {
		'fieldname': 'appointment',
		'non_standard_fieldnames': {
			'Patient Medical Record': 'reference_name'
		'transactions': [
				'label': _('Consultations'),
				'items': ['Patient Encounter', 'Vital Signs', 'Patient Medical Record']

i found this also. so i removed the links but they aren’t going away :slight_smile: i’m doing something wrong.

in a custom script

    frappe.ui.form.on('Sales Order', {
	refresh(frm) {
		setTimeout(() => {
			$("[data-doctype='Auto Repeat']").hide();
			$("[data-doctype='Work Order']").hide();
			$("[data-doctype='Pick List']").hide();
			$("[data-doctype='Material Request']").hide();
			$("[data-doctype='Payment Entry']").hide();
			$("[data-doctype='Payment Request']").hide();
			$("[data-doctype='Journal Entry']").hide();
		}, 10);

if you do changes directly in the python code, dont forget to:
bench build
bench clear-cache
bench restart

1 Like

@Erik_Jeurissen, there’s also a “Linked Documents” section on the DocType itself. This may do teh trick for you.


A generic function to add links in the Connections area (Transactions section). Use like below.
e.g. to add a link to Wallpaper doctype with some counts and add new button hidden.

  frappe.add_dashboard_connection(cur_frm, "Wallpaper", "Related", 10, 5, [ 'WAL-1','WAL-2' ],null,1);

Can be used when add_transactions of frappe dashboard.js cannot be used, for instance when the logic for open count, count or filter for list view is not obvious.

frappe.add_dashboard_connection = function (
  ) {
    if (
      ).length > 0
    ) {
      frm.dashboard.set_badge_count(doctype, open_count, count, names);
    let $group = frm.dashboard.transactions_area
    let $link_template = $(`
    <div class="document-link" data-doctype="${doctype}">
      <div class="document-link-badge" data-doctype="${doctype}">
        <span class="count hidden"></span> <a class="badge-link">${doctype}</a>
      <span class="open-notification" title="Open ${doctype}">0</span>
      <button ${
        hidden ? "hidden" : ""
      } class="btn btn-new btn-secondary btn-xs icon-btn" data-doctype="${doctype}">
        <svg class="icon icon-sm"><use href="#icon-add"></use></svg>
    let _to_list_view = function () {
      frappe.route_options = {
        name: ["in", names],
      frappe.set_route("List", doctype, "List");
    $link_template.on("click", onclick || _to_list_view);
    frm.dashboard.set_badge_count(doctype, open_count, count, names);
1 Like