[MERGE] forward port branch 10.0 up to abb726d4df
This commit is contained in:
@@ -66,10 +66,15 @@ class MailController(http.Controller):
|
||||
# record does not seem to exist -> redirect to login
|
||||
return cls._redirect_to_messaging()
|
||||
record_action = record_sudo.get_access_action()
|
||||
record_target_type = record_action.pop('target_type', 'dummy')
|
||||
|
||||
# the record has an URL redirection: use it directly
|
||||
# the record has a public URL redirection: use it directly
|
||||
if record_action['type'] == 'ir.actions.act_url':
|
||||
return werkzeug.utils.redirect(record_action['url'])
|
||||
if record_target_type == 'public' and not uid:
|
||||
return werkzeug.utils.redirect(record_action['url'])
|
||||
else:
|
||||
# user connected or non-public URL, handled below
|
||||
pass
|
||||
# other choice: act_window (no support of anything else currently)
|
||||
elif not record_action['type'] == 'ir.actions.act_window':
|
||||
return cls._redirect_to_messaging()
|
||||
@@ -83,6 +88,9 @@ class MailController(http.Controller):
|
||||
except AccessError:
|
||||
return cls._redirect_to_messaging()
|
||||
|
||||
if record_action['type'] == 'ir.actions.act_url':
|
||||
return werkzeug.utils.redirect(record_action['url'])
|
||||
|
||||
url_params = {
|
||||
'view_type': record_action['view_type'],
|
||||
'model': model,
|
||||
|
||||
@@ -226,6 +226,7 @@ class BlogPost(models.Model):
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': '/blog/%s/post/%s' % (self.blog_id.id, self.id),
|
||||
'target': 'self',
|
||||
'target_type': 'public',
|
||||
'res_id': self.id,
|
||||
}
|
||||
|
||||
|
||||
@@ -786,6 +786,7 @@ class Post(models.Model):
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': '/forum/%s/question/%s' % (self.forum_id.id, self.id),
|
||||
'target': 'self',
|
||||
'target_type': 'public',
|
||||
'res_id': self.id,
|
||||
}
|
||||
|
||||
|
||||
@@ -450,6 +450,7 @@ class Slide(models.Model):
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': '%s' % self.website_url,
|
||||
'target': 'self',
|
||||
'target_type': 'public',
|
||||
'res_id': self.id,
|
||||
}
|
||||
return super(Slide, self).get_access_action()
|
||||
|
||||
Reference in New Issue
Block a user