def get_default_company(user=None):
 from frappe.defaults import get_user_default_as_list
 if (not user):
  user = frappe.session.user
 companies = get_user_default_as_list(user, u'company')
 if companies:
  default_company = companies[0]
 else:
  default_company = frappe.db.get_single_value(u'Global Defaults', u'default_company')
 return default_company

def get_default_company ( user = None ) : from frappe . defaults import get_user_default_as_list if ( not user ) : user = frappe . session . user companies = get_user_default_as_list ( user , u'company' ) if companies : default_company = companies [ 0 ] else : default_company = frappe . db . get_single_value ( u'Global Defaults' , u'default_company' ) return default_company
get default company for user .