perf: cache child warehouses during a single request (#47837)

Gets called for each row right now, warehouses often same on all
items in a document.
This commit is contained in:
Ankush Menat
2025-06-02 11:06:17 +05:30
committed by GitHub
parent 910c3cc5cf
commit 705b9e0181

View File

@@ -8,6 +8,7 @@ import frappe
from frappe import _, throw
from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.utils import cint
from frappe.utils.caching import request_cache
from frappe.utils.nestedset import NestedSet
from pypika.terms import ExistsCriterion
@@ -221,6 +222,7 @@ def convert_to_group_or_ledger(docname=None):
return frappe.get_doc("Warehouse", docname).convert_to_group_or_ledger()
@request_cache
def get_child_warehouses(warehouse):
from frappe.utils.nestedset import get_descendants_of