[IMP] *: remove _render from ir.ui.view
Follow adaptations made in the render api at odoo/odoo#85110 closes odoo/design-themes#554 Related: odoo/enterprise#24622 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from . import ir_http
|
from . import ir_http
|
||||||
from . import ir_ui_view
|
from . import ir_qweb
|
||||||
from . import website
|
from . import website
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
from odoo.http import request
|
||||||
|
|
||||||
|
|
||||||
|
class IrQWeb(models.AbstractModel):
|
||||||
|
_inherit = "ir.qweb"
|
||||||
|
|
||||||
|
def _prepare_frontend_environment(self, values):
|
||||||
|
irQweb = super()._prepare_frontend_environment(values)
|
||||||
|
|
||||||
|
if 'multi_website_websites' in values:
|
||||||
|
websites_themes = self.env['website'].get_test_themes_websites()
|
||||||
|
|
||||||
|
for multi_website_website in values['multi_website_websites']:
|
||||||
|
website_id = multi_website_website['website_id']
|
||||||
|
website = websites_themes.filtered(lambda website: website.id == website_id)
|
||||||
|
theme_img = None
|
||||||
|
if website:
|
||||||
|
# prefetched by get_test_themes_websites
|
||||||
|
image_ids = website.theme_id.sudo().image_ids
|
||||||
|
if image_ids:
|
||||||
|
theme_img = f"<img src='/web/image/{image_ids[0].id}' width='150'/>"
|
||||||
|
multi_website_website['theme_img'] = theme_img
|
||||||
|
|
||||||
|
return irQweb
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
||||||
|
|
||||||
from odoo import api, models
|
|
||||||
from odoo.http import request
|
|
||||||
|
|
||||||
|
|
||||||
class View(models.Model):
|
|
||||||
_name = "ir.ui.view"
|
|
||||||
_inherit = "ir.ui.view"
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _prepare_qcontext(self):
|
|
||||||
qcontext = super(View, self)._prepare_qcontext()
|
|
||||||
if request and getattr(request, 'is_frontend', False) and 'multi_website_websites' in qcontext:
|
|
||||||
Website = self.env['website']
|
|
||||||
websites_themes = Website.get_test_themes_websites()
|
|
||||||
|
|
||||||
for multi_website_website in qcontext['multi_website_websites']:
|
|
||||||
website_id = multi_website_website['website_id']
|
|
||||||
theme_img = None
|
|
||||||
if website_id in websites_themes.ids:
|
|
||||||
# prefetched by get_test_themes_websites
|
|
||||||
website = Website.browse(website_id)
|
|
||||||
if website.theme_id.sudo().image_ids:
|
|
||||||
theme_img = "<img src='/web/image/%s' width='150'/>" % website.theme_id.sudo().image_ids[0].id
|
|
||||||
multi_website_website['theme_img'] = theme_img
|
|
||||||
return qcontext
|
|
||||||
Reference in New Issue
Block a user