mirror of
https://github.com/frappe/erpnext.git
synced 2026-07-29 23:43:40 +00:00
fix: disable pagination in draft link lookup
frappe.get_list defaults to 20 rows; child-table joins can produce duplicate parent names that fill the window and hide further drafts. Also clarify the check-ordering regression test.
This commit is contained in:
@@ -21,7 +21,7 @@ class DraftLinkFinder:
|
||||
|
||||
names: set[str] = set()
|
||||
for filters in self._link_filters():
|
||||
names.update(frappe.get_list(self.target_doctype, filters=filters, pluck="name"))
|
||||
names.update(frappe.get_list(self.target_doctype, filters=filters, pluck="name", limit=0))
|
||||
return sorted(names)
|
||||
|
||||
def _link_filters(self) -> Iterator[list]:
|
||||
|
||||
@@ -36,7 +36,10 @@ class TestDraftLinks(ERPNextTestSuite):
|
||||
|
||||
self.assertIn(packing_slip.name, get_existing_drafts("Delivery Note", dn.name, "Packing Slip"))
|
||||
|
||||
def test_nonexistent_target_doctype_returns_empty_for_non_admin(self):
|
||||
def test_nonexistent_target_doctype_does_not_raise_for_non_admin(self):
|
||||
# guards check ordering: for non-Administrator users has_permission()
|
||||
# raises DoesNotExistError on unknown doctypes, so existence must be
|
||||
# checked first (Administrator short-circuits and would not catch this)
|
||||
with self.set_user("test@example.com"):
|
||||
drafts = get_existing_drafts("Sales Order", "SO-0001", "Inter Company Purchase Order")
|
||||
self.assertEqual(drafts, [])
|
||||
|
||||
Reference in New Issue
Block a user