fix: remove doctype from link_preview_doctypes if custom value is 0
This commit is contained in:
parent
c424c7e263
commit
685df9b1f1
1 changed files with 12 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue