'Override of BaseModel.get_empty_list_help() to generate an help message
that adds alias information.'

@api.model
def get_empty_list_help(self, help):

    model = self._context.get('empty_list_help_model')
    res_id = self._context.get('empty_list_help_id')
    catchall_domain = self.env['ir.config_parameter'].sudo().get_param('mail.catchall.domain')
    document_name = self._context.get('empty_list_help_document_name', _('document'))
    add_arrow = ((not help) or (help.find('oe_view_nocontent_create') == (-1)))
    alias = None
    if (catchall_domain and model and res_id):
        record = self.env[model].sudo().browse(res_id)
        if (record.alias_id and record.alias_id.alias_name and record.alias_id.alias_model_id and (record.alias_id.alias_model_id.model == self._name) and (record.alias_id.alias_force_thread_id == 0)):
            alias = record.alias_id
    if ((not alias) and catchall_domain and model):
        Alias = self.env['mail.alias']
        aliases = Alias.search([('alias_parent_model_id.model', '=', model), ('alias_name', '!=', False), ('alias_force_thread_id', '=', False), ('alias_parent_thread_id', '=', False)], order='id    ASC')
        if (aliases and (len(aliases) == 1)):
            alias = aliases[0]
    if alias:
        email_link = ("<a    href='mailto:%(email)s'>%(email)s</a>" % {'email': alias.name_get()[0][1]})
        if add_arrow:
            return ("<p    class='oe_view_nocontent_create'>%(dyn_help)s</p>%(static_help)s" % {'static_help': (help or ''), 'dyn_help': (_('Click    here    to    add    new    %(document)s    or    send    an    email    to:    %(email_link)s') % {'document': document_name, 'email_link': email_link})})
        return ('%(static_help)s<p>%(dyn_help)s' % {'static_help': (help or ''), 'dyn_help': (_('You    could    also    add    a    new    %(document)s    by    sending    an    email    to:    %(email_link)s.') % {'document': document_name, 'email_link': email_link})})
    if add_arrow:
        return ("<p    class='oe_view_nocontent_create'>%(dyn_help)s</p>%(static_help)s" % {'static_help': (help or ''), 'dyn_help': (_('Click    here    to    add    new    %s') % document_name)})
    return help
