def match_names_seperatly(cmp_res):
     """
     return tuple partner object,boolean full match
     """
     _logger.info("partner fullname match diff:{}".format(cmp_res))
     if cmp_res:
         partner = obj.browse(cr,uid,cmp_res[0])
         if cmp_res[1] == 1.0:
             return (partner,True)
         if cmp_res[1] > 0.5:
             first_name = partner.first_name if partner.first_name else ''
             cmp_res_first_name = difflib_cmp(ref_vals.first_name, [(partner.id, first_name)])[0]
             last_name =  partner.last_name if partner.last_name else ''
             cmp_res_last_name = difflib_cmp(ref_vals.last_name, [(partner.id, last_name)])[0]
             _logger.info("partner firstname match diff:{}".format(cmp_res_first_name))
             _logger.info("partner lastname match diff:{}".format(cmp_res_last_name))
             # rules, priority full match to less match
             rules = [lambda f,l : f == 0 and l == 1.0,    # no firstname, 100% lastname
                      lambda f,l : f >= 0.7 and l >= 0.85] # seperate firstname/lastname
             res = [func(cmp_res_first_name[1],cmp_res_last_name[1]) for func in rules]
             # return partner,full match or partial match
             return (partner,res[0]) if any(res) else (False,False)
         else:
             return (False,False)
     else:
         return (False,False)
 def match_on_fullname(target_ids):
     match_target_list = []
     for partner in obj.browse(cr,uid,target_ids):
         match_target_list.append((partner.id, concat_names(partner)))
     return difflib_cmp(concat_names(ref_vals), match_target_list)[0] if match_target_list else False