fix: not able to cancel purchase receipt for old subcontracting flow (#40298)
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 91ee53a..8211857 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -559,7 +559,7 @@
{
"incoming_rate": incoming_rate,
"recalculate_rate": 1
- if (self.is_subcontracted and (d.bom or d.fg_item)) or d.from_warehouse
+ if (self.is_subcontracted and (d.bom or d.get("fg_item"))) or d.from_warehouse
else 0,
}
)