'Return the title field of this doctype,
explict via `title_field`, or `title` or `name`'

def get_title_field(self):

    title_field = getattr(self, u'title_field', None)
    if ((not title_field) and self.has_field(u'title')):
        title_field = u'title'
    else:
        title_field = u'name'
    return title_field
