mirror of
https://github.com/odoo/design-themes.git
synced 2025-10-07 01:18:52 +07:00
3c61793056
Since [1], the themes installed in the `_post_init` hook of test_themes
would not go through the `_post_copy()` anymore.
It is not a big deal as this module purpose is to ease our tests and
quickly being able to navigate through themes when we need to, but still
this is something that need to be fixed as otherwise the themes would
not really reflect how they look like.
Typically, go to the Odoo Experts theme, which is supposed to have the
"Contact" header template, it will not have that header layout.
[1]: https://github.com/odoo/odoo/commit/b8a24efa71daea1f96465b780f4f0e384ce74703
closes odoo/design-themes#615
X-original-commit: fea847977d
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
29 lines
1023 B
Python
29 lines
1023 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import models
|
|
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
|
|
def post_init_hook(cr, registry):
|
|
''' Create a new website for each theme and install the theme on it. '''
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
IrModule = env['ir.module.module']
|
|
themes = IrModule.search(IrModule.get_themes_domain(), order='name')
|
|
assert len(themes) == len(env.ref('base.module_test_themes').dependencies_id)
|
|
|
|
xmlids = []
|
|
for theme in themes:
|
|
website = env['website'].create({
|
|
'name': theme.display_name,
|
|
'theme_id': theme.id,
|
|
})
|
|
xmlids.append({
|
|
'xml_id': 'test_themes.%s' % theme.display_name.replace(' ', '_'),
|
|
'record': website,
|
|
'noupdate': True, # Avoid unlink on -u
|
|
})
|
|
theme.with_context(apply_new_theme=True)._theme_get_stream_themes()._theme_load(website)
|
|
env['ir.model.data']._update_xmlids(xmlids)
|