def get_tolerance_for(item_code, item_tolerance={}, global_tolerance=None):
 if item_tolerance.get(item_code):
  return (item_tolerance[item_code], item_tolerance, global_tolerance)
 tolerance = flt((frappe.db.get_value(u'Item', item_code, u'tolerance') or 0))
 if (not tolerance):
  if (global_tolerance == None):
   global_tolerance = flt(frappe.db.get_value(u'Stock Settings', None, u'tolerance'))
  tolerance = global_tolerance
 item_tolerance[item_code] = tolerance
 return (tolerance, item_tolerance, global_tolerance)

def get_tolerance_for ( item_code , item_tolerance = { } , global_tolerance = None ) : if item_tolerance . get ( item_code ) : return ( item_tolerance [ item_code ] , item_tolerance , global_tolerance ) tolerance = flt ( ( frappe . db . get_value ( u'Item' , item_code , u'tolerance' ) or 0 ) ) if ( not tolerance ) : if ( global_tolerance == None ) : global_tolerance = flt ( frappe . db . get_value ( u'Stock Settings' , None , u'tolerance' ) ) tolerance = global_tolerance item_tolerance [ item_code ] = tolerance return ( tolerance , item_tolerance , global_tolerance )
returns the tolerance for the item .