mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 16:15:02 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user