[MERGE] forward port branch 10.0 up to abb726d4df

This commit is contained in:
Christophe Simonis
2017-09-04 18:47:40 +02:00
4 changed files with 13 additions and 2 deletions
+10 -2
View File
@@ -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,
}
+1
View File
@@ -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,
}
+1
View File
@@ -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()