From 685df9b1f16e9a03a93df36fec978ba908fe2f4f Mon Sep 17 00:00:00 2001 From: prssanna Date: Sun, 19 Apr 2020 14:33:52 +0530 Subject: [PATCH] fix: remove doctype from link_preview_doctypes if custom value is 0 --- frappe/boot.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frappe/boot.py b/frappe/boot.py index 8b9668430c..eed434f870 100644 --- a/frappe/boot.py +++ b/frappe/boot.py @@ -268,10 +268,18 @@ def get_success_action(): return frappe.get_all("Success Action", fields=["*"]) def get_link_preview_doctypes(): + from frappe.utils import cint + link_preview_doctypes = [d.name for d in frappe.db.get_all('DocType', {'show_preview_popup': 1})] customizations = frappe.get_all("Property Setter", - fields=['doc_type'], - filters={'property': 'show_preview_popup', 'value': "1" - }) - link_preview_doctypes += [custom.doc_type for custom in customizations] + fields=['doc_type', 'value'], + filters={'property': 'show_preview_popup'} + ) + + for custom in customizations: + if not cint(custom.value) and custom.doc_type in link_preview_doctypes: + link_preview_doctypes.remove(custom.doc_type) + else: + link_preview_doctypes.append(custom.doc_type) + return link_preview_doctypes