fix: validate over ordering of quotation

(cherry picked from commit 4cc306d2d8)

# Conflicts:
#	erpnext/patches.txt
This commit is contained in:
Mihir Kandoi
2026-01-30 16:37:08 +05:30
committed by Mergify
parent e23e9b5d66
commit e7ace8e620
7 changed files with 56 additions and 23 deletions

View File

@@ -0,0 +1,16 @@
import frappe
def execute():
data = frappe.get_all(
"Sales Order Item",
filters={"quotation_item": ["is", "set"], "docstatus": 1},
fields=["quotation_item", {"SUM": "stock_qty", "as": "ordered_qty"}],
group_by="quotation_item",
)
if data:
frappe.db.auto_commit_on_many_writes = 1
frappe.db.bulk_update(
"Quotation Item", {d.quotation_item: {"ordered_qty": d.ordered_qty} for d in data}
)
frappe.db.auto_commit_on_many_writes = 0