Files
odoo_source/addons/website_theme_install/tests/test_theme.py
T
Romain Derie 3f5a6f423d [FIX] website: fix install theme error
Commit 5a81d8883 fixed the COW view deletion on module update but introduced an
error when installing a theme.

Indeed, when installing a theme, the first step is to remove the currently
installed theme from the website (by unlinking its ir.ui.view).

Commit 5a81d8883 introduced the fact that deleting an ir.ui.view during a
module uninstall also search and delete the COW views, calling
`_get_specific_views` (that expects a singleton).

When installing a theme, it calls `_theme_cleanup` which search COW views and
unlink them. If not cow view, unlink is called with an empty record set raising
the singleton error.

closes odoo/odoo#31662

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-07 13:36:10 +00:00

15 lines
536 B
Python

# coding: utf-8
from odoo.tests import common
class TestTheme(common.TransactionCase):
def test_theme_remove_working(self):
""" This test ensure theme can be removed.
Theme removal is also the first step during theme installation.
"""
theme_common_module = self.env['ir.module.module'].search([('name', '=', 'theme_default')])
website = self.env['website'].get_current_website()
website.theme_id = theme_common_module.id
self.env['ir.module.module']._theme_remove(website)