feat: share table size heuristic with meta
This commit is contained in:
parent
4406116f86
commit
8eafe67805
1 changed files with 6 additions and 0 deletions
|
|
@ -59,6 +59,11 @@ DEFAULT_FIELD_LABELS = {
|
|||
"_assign": _lt("Assigned To"),
|
||||
}
|
||||
|
||||
# When number of rows in a table exceeds this number, we disable certain features automatically.
|
||||
# This is done to avoid hammering the site with unnecessary requests that are just meant for
|
||||
# improving UX.
|
||||
LARGE_TABLE_THRESHOLD = 100_000
|
||||
|
||||
|
||||
def get_meta(doctype: str | dict | DocRef, cached=True) -> "_Meta":
|
||||
"""Get metadata for a doctype.
|
||||
|
|
@ -185,6 +190,7 @@ class Meta(Document):
|
|||
self.get_valid_columns()
|
||||
self.set_custom_permissions()
|
||||
self.add_custom_links_and_actions()
|
||||
self.is_large_table = frappe.db.estimate_count(self.name) > LARGE_TABLE_THRESHOLD
|
||||
|
||||
def as_dict(self, no_nulls=False):
|
||||
def serialize(doc):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue