diff --git a/frappe/custom/doctype/custom_link/__init__.py b/frappe/custom/doctype/custom_link/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frappe/custom/doctype/custom_link/custom_link.js b/frappe/custom/doctype/custom_link/custom_link.js deleted file mode 100644 index 8662724b1a..0000000000 --- a/frappe/custom/doctype/custom_link/custom_link.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2020, Frappe Technologies and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Custom Link', { - refresh: function(frm) { - frm.set_query("document_type", function () { - return { - filters: { - custom: 0, - istable: 0, - module: ['not in', ["Email", "Core", "Custom", "Event Streaming", "Social", "Data Migration", "Geo", "Desk"]] - } - }; - }); - - frm.add_custom_button(__('Go to {0} List', [frm.doc.document_type]), function() { - frappe.set_route('List', frm.doc.document_type); - }); - } -}); diff --git a/frappe/custom/doctype/custom_link/custom_link.json b/frappe/custom/doctype/custom_link/custom_link.json deleted file mode 100644 index 350e6b1c2d..0000000000 --- a/frappe/custom/doctype/custom_link/custom_link.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "actions": [], - "autoname": "field:document_type", - "creation": "2020-04-08 15:16:44.342509", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "document_type", - "links" - ], - "fields": [ - { - "fieldname": "document_type", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Document Type", - "options": "DocType", - "reqd": 1, - "unique": 1 - }, - { - "fieldname": "links", - "fieldtype": "Table", - "label": "Links", - "options": "DocType Link" - } - ], - "links": [], - "modified": "2020-04-08 16:42:59.402671", - "modified_by": "Administrator", - "module": "Custom", - "name": "Custom Link", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/frappe/custom/doctype/custom_link/custom_link.py b/frappe/custom/doctype/custom_link/custom_link.py deleted file mode 100644 index 11316d5751..0000000000 --- a/frappe/custom/doctype/custom_link/custom_link.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Frappe Technologies and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class CustomLink(Document): - pass diff --git a/frappe/custom/doctype/custom_link/test_custom_link.py b/frappe/custom/doctype/custom_link/test_custom_link.py deleted file mode 100644 index a292f73ad0..0000000000 --- a/frappe/custom/doctype/custom_link/test_custom_link.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Frappe Technologies and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestCustomLink(unittest.TestCase): - pass diff --git a/frappe/database/database.py b/frappe/database/database.py index 64b234b1d3..616dd3c3ec 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -780,6 +780,9 @@ class Database(object): """Returns True if table for given doctype exists.""" return ("tab" + doctype) in self.get_tables() + def has_table(self, doctype): + return self.table_exists(doctype) + def get_tables(self): tables = frappe.cache().get_value('db_tables') if not tables: diff --git a/frappe/model/meta.py b/frappe/model/meta.py index 4299876a77..cdd4b34ae8 100644 --- a/frappe/model/meta.py +++ b/frappe/model/meta.py @@ -479,9 +479,6 @@ class Meta(Document): if hasattr(self, 'links') and self.links: dashboard_links.extend(self.links) - if frappe.get_all("Custom Link", {"document_type": self.name}): - dashboard_links.extend(frappe.get_doc("Custom Link", self.name).links) - if not data.transactions: # init groups data.transactions = [] diff --git a/frappe/patches.txt b/frappe/patches.txt index 05f067f4b9..2202557b40 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -313,3 +313,4 @@ frappe.patches.v13_0.update_newsletter_content_type execute:frappe.db.set_value('Website Settings', 'Website Settings', {'navbar_template': 'Standard Navbar', 'footer_template': 'Standard Footer'}) frappe.patches.v13_0.delete_event_producer_and_consumer_keys frappe.patches.v13_0.web_template_set_module #2020-10-05 +frappe.patches.v13_0.remove_custom_link diff --git a/frappe/patches/v13_0/remove_custom_link.py b/frappe/patches/v13_0/remove_custom_link.py new file mode 100644 index 0000000000..9c2a441a62 --- /dev/null +++ b/frappe/patches/v13_0/remove_custom_link.py @@ -0,0 +1,15 @@ +import frappe + +def execute(): + ''' + Remove the doctype "Custom Link" that was used to add Custom Links to the + Dashboard since this is now managed by Customize Form. + Update `parent` property to the DocType and delte the doctype + ''' + + if frappe.db.has_table('Custom Link'): + for custom_link in frappe.get_all('Custom Link', ['name', 'document_type']): + frappe.db.sql('update `tabDocType Link` set custom=1, parent=%s where parent=%s', + (custom_link.document_type, custom_link.name)) + + frappe.delete_doc('DocType', 'Custom Link') \ No newline at end of file