def validate_bom_no(item, bom_no):
 bom = frappe.get_doc(u'BOM', bom_no)
 if (not bom.is_active):
  frappe.throw(_(u'BOM {0} must be active').format(bom_no))
 if (bom.docstatus != 1):
  if (not getattr(frappe.flags, u'in_test', False)):
   frappe.throw(_(u'BOM {0} must be submitted').format(bom_no))
 if (item and (not ((bom.item.lower() == item.lower()) or (bom.item.lower() == cstr(frappe.db.get_value(u'Item', item, u'variant_of')).lower())))):
  frappe.throw(_(u'BOM {0} does not belong to Item {1}').format(bom_no, item))

def validate_bom_no ( item , bom_no ) : bom = frappe . get_doc ( u'BOM' , bom_no ) if ( not bom . is_active ) : frappe . throw ( _ ( u'BOM {0} must be active' ) . format ( bom_no ) ) if ( bom . docstatus != 1 ) : if ( not getattr ( frappe . flags , u'in_test' , False ) ) : frappe . throw ( _ ( u'BOM {0} must be submitted' ) . format ( bom_no ) ) if ( item and ( not ( ( bom . item . lower ( ) == item . lower ( ) ) or ( bom . item . lower ( ) == cstr ( frappe . db . get_value ( u'Item' , item , u'variant_of' ) ) . lower ( ) ) ) ) ) : frappe . throw ( _ ( u'BOM {0} does not belong to Item {1}' ) . format ( bom_no , item ) )
validate bom no of sub-contracted items .