feat: Configurable search link limit (#24539)
This commit is contained in:
parent
aa7e111186
commit
63e2e2db56
3 changed files with 26 additions and 2 deletions
|
|
@ -94,7 +94,9 @@
|
|||
"dormant_days",
|
||||
"telemetry_section",
|
||||
"allow_error_traceback",
|
||||
"enable_telemetry"
|
||||
"enable_telemetry",
|
||||
"search_section",
|
||||
"link_field_results_limit"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
|
|
@ -634,12 +636,24 @@
|
|||
{
|
||||
"fieldname": "column_break_uhqk",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "search_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Search"
|
||||
},
|
||||
{
|
||||
"default": "10",
|
||||
"fieldname": "link_field_results_limit",
|
||||
"fieldtype": "Int",
|
||||
"label": "Link Field Results Limit",
|
||||
"non_negative": 1
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cog",
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2023-12-08 15:52:37.525003",
|
||||
"modified": "2024-01-26 11:29:20.924425",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "System Settings",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class SystemSettings(Document):
|
|||
hide_footer_in_auto_email_reports: DF.Check
|
||||
language: DF.Link
|
||||
lifespan_qrcode_image: DF.Int
|
||||
link_field_results_limit: DF.Int
|
||||
login_with_email_link: DF.Check
|
||||
login_with_email_link_expiry: DF.Int
|
||||
logout_on_password_reset: DF.Check
|
||||
|
|
@ -94,6 +95,7 @@ class SystemSettings(Document):
|
|||
two_factor_method: DF.Literal["OTP App", "SMS", "Email"]
|
||||
welcome_email_template: DF.Link | None
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
from frappe.twofactor import toggle_two_factor_auth
|
||||
|
||||
|
|
@ -130,6 +132,13 @@ class SystemSettings(Document):
|
|||
self.validate_backup_limit()
|
||||
self.validate_file_extensions()
|
||||
|
||||
if self.link_field_results_limit > 50:
|
||||
self.link_field_results_limit = 50
|
||||
label = _(self.meta.get_label("link_field_results_limit"))
|
||||
frappe.msgprint(
|
||||
_("{0} can not be more than {1}").format(label, 50), alert=True, indicator="yellow"
|
||||
)
|
||||
|
||||
def validate_user_pass_login(self):
|
||||
if not self.disable_user_pass_login:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
|
|||
doctype: doctype,
|
||||
ignore_user_permissions: me.df.ignore_user_permissions,
|
||||
reference_doctype: me.get_reference_doctype() || "",
|
||||
page_length: cint(frappe.boot.sysdefaults.link_field_results_limit) || 10,
|
||||
};
|
||||
|
||||
me.set_custom_query(args);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue