def encode_company_abbr(name, company):
 company_abbr = frappe.db.get_value(u'Company', company, u'abbr')
 parts = name.rsplit(u' - ', 1)
 if (parts[(-1)].lower() != company_abbr.lower()):
  parts.append(company_abbr)
 return u' - '.join([parts[0], company_abbr])

def encode_company_abbr ( name , company ) : company_abbr = frappe . db . get_value ( u'Company' , company , u'abbr' ) parts = name . rsplit ( u' - ' , 1 ) if ( parts [ ( - 1 ) ] . lower ( ) != company_abbr . lower ( ) ) : parts . append ( company_abbr ) return u' - ' . join ( [ parts [ 0 ] , company_abbr ] )
returns name encoded with company abbreviation .