From faa69c942b239000227d5b28564dfa4aae75f1be Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 19 May 2022 21:24:31 +0530 Subject: [PATCH] perf: Use cached doc instead of `get_doc` - Doc is only used to iterate over items(which wont change) and change rate/amount of rows - These changes are inserted in db via `db_update`, so no harm - Tested locally: refetching cached doc after db update, reflects fresh data. --- .../manufacturing/doctype/bom_update_tool/bom_update_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py index 41922fb82459..c308c3f184cd 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py @@ -48,7 +48,7 @@ def update_cost() -> None: """Updates Cost for all BOMs from bottom to top.""" bom_list = get_boms_in_bottom_up_order() for bom in bom_list: - bom_doc = frappe.get_doc("BOM", bom) + bom_doc = frappe.get_cached_doc("BOM", bom) bom_doc.calculate_cost(save_updates=True, update_hour_rate=True) # bom_doc.update_exploded_items(save=True) #TODO: edit exploded items rate bom_doc.db_update()