From 6ddc487fb63f526f4103fd158f272177ba7b4616 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 11 Dec 2014 17:33:41 +0530 Subject: [PATCH] patch fix --- erpnext/patches/v4_2/recalculate_bom_costs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v4_2/recalculate_bom_costs.py b/erpnext/patches/v4_2/recalculate_bom_costs.py index 8c887a83f0..25fd7f3459 100644 --- a/erpnext/patches/v4_2/recalculate_bom_costs.py +++ b/erpnext/patches/v4_2/recalculate_bom_costs.py @@ -5,7 +5,9 @@ from __future__ import unicode_literals import frappe def execute(): - for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2 and total_fixed_cost IS NOT NULL""", as_dict=1): + for d in frappe.db.sql("""select bom.name from `tabBOM` bom where bom.docstatus < 2 and + exists(select bom_item.name from `tabBOM Operation` bom_op where + bom.name = bom_op.parent and bom_op.fixed_cycle_cost IS NOT NULL)""", as_dict=1): try: bom = frappe.get_doc('BOM', d.name) bom.ignore_validate_update_after_submit = True