mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-28 14:18:24 +00:00
perf: batch status check for on-hold/closed documents, remove N+1 queries (backport #54798) (#55573)
* perf: batch status check for on-hold/closed documents, remove N+1 queries (#54798)
(cherry picked from commit 5074597d00)
# Conflicts:
# erpnext/buying/doctype/purchase_order/purchase_order.py
* chore: resolve conflicts
---------
Co-authored-by: Shubh Doshi <124681920+shubhdoshi21@users.noreply.github.com>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -727,19 +727,6 @@ class BuyingController(SubcontractingController):
|
||||
)
|
||||
)
|
||||
|
||||
def check_for_on_hold_or_closed_status(self, ref_doctype, ref_fieldname):
|
||||
for d in self.get("items"):
|
||||
if d.get(ref_fieldname):
|
||||
status = frappe.db.get_value(ref_doctype, d.get(ref_fieldname), "status")
|
||||
if status in ("Closed", "On Hold"):
|
||||
frappe.throw(
|
||||
_("{ref_doctype} {ref_name} is {status}.").format(
|
||||
ref_doctype=frappe.bold(_(ref_doctype)),
|
||||
ref_name=frappe.bold(d.get(ref_fieldname)),
|
||||
status=frappe.bold(_(status)),
|
||||
)
|
||||
)
|
||||
|
||||
def update_stock_ledger(self, allow_negative_stock=False, via_landed_cost_voucher=False):
|
||||
self.update_ordered_and_reserved_qty()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user