refactor(subcontracting): fetch customer_warehouse only when needed

In `validate_manufacture`, `customer_warehouse` is read only inside the
`skip_transfer` branch but was fetched unconditionally, wasting a lookup on
the non-skip-transfer path. Move it inside the branch that uses it.
This commit is contained in:
Mihir Kandoi
2026-06-22 07:49:57 +05:30
parent e422c4d2ab
commit 8218875733

View File

@@ -247,10 +247,10 @@ class SubcontractingInwardController:
and frappe.get_cached_value("Item", item.item_code, "is_customer_provided_item")
]
customer_warehouse = frappe.get_cached_value(
"Subcontracting Inward Order", self.subcontracting_inward_order, "customer_warehouse"
)
if frappe.get_cached_value("Work Order", self.work_order, "skip_transfer"):
customer_warehouse = frappe.get_cached_value(
"Subcontracting Inward Order", self.subcontracting_inward_order, "customer_warehouse"
)
table = frappe.qb.DocType("Subcontracting Inward Order Received Item")
query = (
frappe.qb.from_(table)