'generate a signup url for the given partner ids and action, possibly overriding
the url state components (menu_id, id, view_type)'

@api.multi
def _get_signup_url_for_action(self, action=None, view_type=None, menu_id=None, res_id=None, model=None):

    res = dict.fromkeys(self.ids, False)
    base_url = self.env['ir.config_parameter'].get_param('web.base.url')
    for partner in self:
        if (self.env.context.get('signup_valid') and (not partner.user_ids)):
            partner.signup_prepare()
        route = 'login'
        query = dict(db=self.env.cr.dbname)
        signup_type = self.env.context.get('signup_force_type_in_url', (partner.signup_type or ''))
        if signup_type:
            route = ('reset_password' if (signup_type == 'reset') else signup_type)
        if (partner.signup_token and signup_type):
            query['token'] = partner.signup_token
        elif partner.user_ids:
            query['login'] = partner.user_ids[0].login
        else:
            continue
        fragment = dict()
        base = '/web#'
        if (action == '/mail/view'):
            base = '/mail/view?'
        elif action:
            fragment['action'] = action
        if view_type:
            fragment['view_type'] = view_type
        if menu_id:
            fragment['menu_id'] = menu_id
        if model:
            fragment['model'] = model
        if res_id:
            fragment['res_id'] = res_id
        if fragment:
            query['redirect'] = (base + werkzeug.url_encode(fragment))
        res[partner.id] = urljoin(base_url, ('/web/%s?%s' % (route, werkzeug.url_encode(query))))
    return res
