Hi guys,
I have been trying to modify these links under Connections. Where can i edit these links?
https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form
In there you find “link documents”.
i want to remove the default ones. these are not defined there
Hi Erik,
The only way I know is modifying the related Python code.
This is the path to the file for Patient Appointments:
../apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
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 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
@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 (
frm,
doctype,
group,
open_count,
count,
names,
onclick,
hidden
) {
if (
frm.dashboard.transactions_area.find(
`.document-link[data-doctype="${doctype}"]`
).length > 0
) {
frm.dashboard.set_badge_count(doctype, open_count, count, names);
return;
}
let $group = frm.dashboard.transactions_area
.find(`.form-link-title:contains('${group}')`)
.get(0);
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>
</div>
<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>
</button>
</div>
`);
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.transactions_area
.find(`.form-link-title:contains('${group}')`)
.after($link_template);
frm.dashboard.set_badge_count(doctype, open_count, count, names);
};
This looks very helpful, but quite difficult.
Would you help me decide if I need to use it in my case?
I am trying, without success, to customise the “Fulfilment” group of the “Connections” section of “Sales Order” to include a reference to a child table field in my app.
The app I am developing is for delivery route planning. It allows back office staff to coordinate contacting dozens of repeat customers on one of many delivery routes. For each address on a route a user can quickly record the results of a phone call. When the customer’s requests have been confirmed, the user can generate a Sales Order at the click of a button.
I have a parent DocType “Route Planner” and a child DocType “Route Stop”.
“Route Planner” has a table
field “stop_addr” to contain the table of “Route Stop” rows.
Each “Route Stop” item has a button field “Generate Sales Order” and a read only LInk field “Sales Order Name” (sales_order_name).
I have tried to customise the Sales Order DocType like this :
Route Planner does appear in the correct place in the “Connections” section of “Sales Order”, but Sales Orders generated from my app do not add a number to the tag as a connection back to a Quotation would, for example.
It is also the case that attempting to delete the Sales Order will fail with a warning about an existing reference to it from a “Route Planner”, so the connection is understood to exist.
Questions:
Is it possible to make sales_order_name a Link field? at least to check if that fixes the count issue…
Oh yes! It is indeed a Link field.
I should have mentioned that, sorry.
Guys i have the Customer ERPNEXT doctype i have added the connections i want in linked documents below but still i cant see the connections in the doctypes.
i could not find the employee_dashboard.py??