mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
feat: add get_parent_supplier_groups using query builder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,3 +70,13 @@ class SupplierGroup(NestedSet):
|
|||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
NestedSet.validate_if_child_exists(self)
|
NestedSet.validate_if_child_exists(self)
|
||||||
frappe.utils.nestedset.update_nsm(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