Skip to content

Commit

Permalink
perf: cached get_last_purchase_details to fix performance issue (back…
Browse files Browse the repository at this point in the history
…port #39854) (#39855)

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

(cherry picked from commit b966c06)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Feb 12, 2024
1 parent de6e8c7 commit 08e0271
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions erpnext/controllers/stock_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,9 @@ def validate_putaway_capacity(self):
"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

Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/doctype/item/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 08e0271

Please sign in to comment.