Merge branch 'master-gaurav-19072018' into 'master-patch-july-2018'

[Add] Added Upstream Patch For website_blog,website_event,website_forum

See merge request flectra-hq/flectra!105
This commit is contained in:
Parthiv Patel 2018-07-19 11:48:38 +00:00
commit d04e148d82
4 changed files with 7 additions and 7 deletions

View File

@ -233,7 +233,7 @@ class BlogPost(models.Model):
return super(BlogPost, self).get_access_action(access_uid)
return {
'type': 'ir.actions.act_url',
'url': self.url,
'url': self.website_url,
'target': 'self',
'target_type': 'public',
'res_id': self.id,

View File

@ -79,7 +79,7 @@ class Event(models.Model):
event.menu_id = root_menu
existing_page_names = event.menu_id.child_id.mapped('name')
required_page_names = [entry[0] for entry in self._get_menu_entries()]
required_page_names = [entry[0] for entry in event._get_menu_entries()]
standard_page_names = self._get_standard_menu_entries_names()
# remove entries that should not exist anymore
@ -87,11 +87,11 @@ class Event(models.Model):
submenu_to_delete.unlink()
# create missing entries
for sequence, (name, url, xml_id) in enumerate(self._get_menu_entries()):
for sequence, (name, url, xml_id) in enumerate(event._get_menu_entries()):
if name not in existing_page_names:
if not url:
newpath = self.env['website'].new_page(name + ' ' + self.name, template=xml_id, ispage=False)['url']
url = "/event/" + slug(self) + "/page/" + newpath[1:]
newpath = self.env['website'].new_page(name + ' ' + event.name, template=xml_id, ispage=False)['url']
url = "/event/" + slug(event) + "/page/" + newpath[1:]
self.env['website.menu'].create({
'name': name,
'url': url,

View File

@ -509,7 +509,7 @@ class Post(models.Model):
self.env.user.sudo().add_karma(post.forum_id.karma_gen_answer_accept * mult)
if 'tag_ids' in vals:
tag_ids = set(tag.get('id') for tag in self.resolve_2many_commands('tag_ids', vals['tag_ids']))
if any(set(post.tag_ids) != tag_ids for post in self) and any(self.env.user.karma < post.forum_id.karma_edit_retag for post in self):
if any(set(post.tag_ids.ids) != tag_ids for post in self) and any(self.env.user.karma < post.forum_id.karma_edit_retag for post in self):
raise KarmaError(_('Not enough karma to retag.'))
if any(key not in trusted_keys for key in vals) and any(not post.can_edit for post in self):
raise KarmaError('Not enough karma to edit a post.')

View File

@ -620,7 +620,7 @@
<div t-if="not is_answer">
<br/>
<input type="hidden" name="karma_edit_retag" t-attf-value="#{forum.karma_edit_retag}" id="karma_edit_retag"/>
<input type="text" name="post_tags" class="form-control col-md-9 js_select2" placeholder="Tags" t-attf-data-init-value="#{tags}" value="Tags"/>
<input type="text" name="post_tags" class="form-control col-md-9 js_select2" placeholder="Tags" t-attf-data-init-value="#{tags}" value="Tags" t-att-readonly="user.karma &lt; forum.karma_edit_retag" t-att-title="'You need to have sufficient karma to edit tags' if user.karma &lt; forum.karma_edit_retag else ''"/>
<br/>
</div>
<button type="submit" class="btn btn-primary btn-lg">Save</button>