ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Export Fixtures for doctype Links

Can I Export Fixtures for Doctype links
Thank you

in v13, at present i donot see out of box solution for this. You need to write a custom method to create document links in core doctype and then call it in say after_migration hook

def update_dashboard_link_for_core_doctype(doctype,link_doctype,link_fieldname,group=None):
try:
	d = frappe.get_doc("Customize Form")
	if doctype:
		d.doc_type = doctype
	d.run_method("fetch_to_customize")
	for link in d.get('links'):
		if link.link_doctype==link_doctype and link.link_fieldname==link_fieldname:
			# found so just return
			return
	d.append('links', dict(link_doctype=link_doctype, link_fieldname=link_fieldname,table_fieldname=None,group=group))
	d.run_method("save_customization")
	frappe.clear_cache()
except Exception:
	frappe.log_error(frappe.get_traceback())

and call it in say after_migration hook

update_dashboard_link_for_core_doctype(doctype='Supplier',link_doctype='Supplier Item Directive',link_fieldname='supplier')

ashish
greycube.in

1 Like

Thanks