mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
feat: add get_parent_supplier_groups using query builder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit cb610b79d2)
This commit is contained in:
@@ -70,3 +70,13 @@ class SupplierGroup(NestedSet):
|
||||
def on_trash(self):
|
||||
NestedSet.validate_if_child_exists(self)
|
||||
frappe.utils.nestedset.update_nsm(self)
|
||||
|
||||
|
||||
def get_parent_supplier_groups(supplier_group):
|
||||
lft, rgt = frappe.db.get_value("Supplier Group", supplier_group, ["lft", "rgt"])
|
||||
return frappe.get_all(
|
||||
"Supplier Group",
|
||||
filters=[["lft", "<=", lft], ["rgt", ">=", rgt]],
|
||||
fields=["name"],
|
||||
order_by="lft asc",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user