fix: Add try-finally for setting buying price list

(cherry picked from commit 35a8d02866)
(cherry picked from commit e21baec246)
This commit is contained in:
Mihir Kandoi
2025-10-01 18:39:29 +05:30
committed by Mergify
parent c455e7390e
commit e10ed89be5

View File

@@ -11,6 +11,8 @@ def execute():
)
old_limit = frappe.db.MAX_WRITES_PER_TRANSACTION
frappe.db.MAX_WRITES_PER_TRANSACTION *= 4
for doc in docs:
frappe.db.set_value("Material Request", doc, "buying_price_list", default_buying_price_list)
frappe.db.MAX_WRITES_PER_TRANSACTION = old_limit
try:
for doc in docs:
frappe.db.set_value("Material Request", doc, "buying_price_list", default_buying_price_list)
finally:
frappe.db.MAX_WRITES_PER_TRANSACTION = old_limit