'Account must be ledger, active and not freezed'

def validate_account_details(self, adv_adj):

    ret = frappe.db.sql(u'select    is_group,    docstatus,    company\n DCTB  DCTB  DCTB from    tabAccount    where    name=%s', self.account, as_dict=1)[0]
    if (ret.is_group == 1):
        frappe.throw(_(u'{0}    {1}:    Account    {2}    cannot    be    a    Group').format(self.voucher_type, self.voucher_no, self.account))
    if (ret.docstatus == 2):
        frappe.throw(_(u'{0}    {1}:    Account    {2}    is    inactive').format(self.voucher_type, self.voucher_no, self.account))
    if (ret.company != self.company):
        frappe.throw(_(u'{0}    {1}:    Account    {2}    does    not    belong    to    Company    {3}').format(self.voucher_type, self.voucher_no, self.account, self.company))
