Skip to content
Permalink
Browse files

🚑 all blogs on websites for admin

  • Loading branch information...
KolushovAlexandr committed Jul 1, 2019
1 parent d9d0ff8 commit 868f857422a1fa7510b08e7324d1416e6983e49c
@@ -1 +1,4 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import models
from . import controllers
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import main
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import SUPERUSER_ID
from odoo import http
from odoo.addons.website_blog.controllers.main import WebsiteBlog
from odoo.http import request


class WebsiteBlogExtended(WebsiteBlog):

@http.route()
def blog(self, blog=None, tag=None, page=1, **opt):
blog_super = super(WebsiteBlogExtended, self).blog(blog, tag, page, **opt)

if request.env.context.get('uid', 0) == SUPERUSER_ID:
blog_env = blog_super.qcontext['blogs']
updated_blogs = blog_env.search(request.env.ref('website_multi_company_blog.blog_rule_all').domain)
blog_super.qcontext.update({
'blogs': updated_blogs,
})
return blog_super

0 comments on commit 868f857

Please sign in to comment.
You can’t perform that action at this time.