def search_account(company, chart_template, field_name, domain):
    template_code = chart_template[field_name].code
    domain = ([('company_id', '=', company.id)] + domain)
    account = None
    if template_code:
        account = cls.env['account.account'].search((domain + [('code', '=like', (template_code + '%'))]), limit=1)
    if (not account):
        account = cls.env['account.account'].search(domain, limit=1)
    return account
def search_account(company, chart_template, field_name, domain):
    template_code = chart_template[field_name].code
    domain = ([('company_id', '=', company.id)] + domain)
    account = None
    if template_code:
        account = cls.env['account.account'].search((domain + [('code', '=like', (template_code + '%'))]), limit=1)
    if (not account):
        account = cls.env['account.account'].search(domain, limit=1)
    return account