Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions website_seo_blog/data/website_blog_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!-- Add seo url to all existing blogs and blog posts, its needed for existing databases, we don't update the url fields of the website blog records "menu_news"
and "action_open_website" because a template reference is used here and we can't use the seo_url field in a dynamically way -->
<function name="add_seo_url" model="blog.blog" />
<function name="add_seo_url" model="blog.tag" />

</data>
</openerp>
7 changes: 7 additions & 0 deletions website_seo_blog/models/website_blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ def get_default_meta_robots(self):
cfg = self.env['website.config.settings'].search([])
return cfg and cfg[0].website_blog_tag_default_meta_robots or False

@api.model
def add_seo_url(self):
for tag in self.env['blog.tag'].search([('seo_url', '=', False)]):
tag.write({'seo_url': slug(tag)})

return True


class Website(models.Model):
_inherit = 'website'
Expand Down