mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 17:08:42 +00:00
refactor(controllers): convert StockController future-SLE/GL checks to qb/ORM
- make_gl_entries_on_cancel: raw GL Entry existence select -> frappe.db.exists. - future_sle_exists: raw GROUP BY count -> frappe.qb Count with Criterion.any, and get_conditions_to_validate_future_sle builds qb Criterion objects (warehouse == x & item_code.isin(...)) instead of escaped SQL strings. Parity-preserving and valid on Postgres. Surgical re-apply: develop's check_item_quality_inspection fix (`return items if doctype == "Stock Entry" else []`) is preserved (the staging branch predated and would have reverted it). Adds a test asserting future_sle_exists detects a later SLE for the same item/warehouse on both engines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -630,7 +630,7 @@ def check_item_quality_inspection(doctype: str, docstatus: str | int, items: str
|
||||
|
||||
inspection_fieldname = INSPECTION_FIELDNAME_MAP.get(doctype)
|
||||
if inspection_fieldname is None:
|
||||
return []
|
||||
return items if doctype == "Stock Entry" else []
|
||||
|
||||
allow_after_transaction = cint(docstatus) == 1 and frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
||||
|
||||
Reference in New Issue
Block a user