perf: cached get_last_purchase_details to fix performance issue (backport #39854) (#39855)

perf: cached get_last_purchase_details to fix performance issue (#39854)

(cherry picked from commit b966c06a4f)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-02-12 15:54:03 +05:30
committed by GitHub
parent de6e8c74c5
commit 08e02710cd
2 changed files with 4 additions and 0 deletions

View File

@@ -831,6 +831,9 @@ class StockController(AccountsController):
"Stock Reconciliation",
)
if not frappe.get_all("Putaway Rule", limit=1):
return
if self.doctype == "Purchase Invoice" and self.get("update_stock") == 0:
valid_doctype = False

View File

@@ -1047,6 +1047,7 @@ def validate_cancelled_item(item_code, docstatus=None):
frappe.throw(_("Item {0} is cancelled").format(item_code))
@frappe.request_cache
def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
"""returns last purchase details in stock uom"""
# get last purchase order item details