mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 14:09:19 +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 import _, throw
|
||||||
from frappe.contacts.address_and_contact import load_address_and_contact
|
from frappe.contacts.address_and_contact import load_address_and_contact
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint
|
||||||
|
from frappe.utils.caching import request_cache
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
from pypika.terms import ExistsCriterion
|
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()
|
return frappe.get_doc("Warehouse", docname).convert_to_group_or_ledger()
|
||||||
|
|
||||||
|
|
||||||
|
@request_cache
|
||||||
def get_child_warehouses(warehouse):
|
def get_child_warehouses(warehouse):
|
||||||
from frappe.utils.nestedset import get_descendants_of
|
from frappe.utils.nestedset import get_descendants_of
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user