summaryrefslogtreecommitdiff
path: root/addons/website/tests/test_views.py
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2020-05-18 10:51:30 +0000
committerfja-odoo <fja@odoo.com>2020-05-19 15:42:55 +0000
commit1eb7c577ecb31c2f0876b6dd76769e2b47802cb0 (patch)
tree94f6dbb457ed56dfdaaeef1c66cb19b772ca48b1 /addons/website/tests/test_views.py
parent8adaaf50741c460122ce111bfd676538c1577bb9 (diff)
[FIX] website_theme_install, base: fix theme update
When a theme module is updated the changes made on a view are considered as user changes, prenventing the view from being updated in the future. Fixed by comparing the arch being written with the arch of the original view. If it is the same the record should not be noupdate. Plus added a test to make sure the theme views receive theme updates after being updated once. Introduced by: https://github.com/odoo/odoo/commit/4acf177b4c55f3a16362cbeafea3d332ef4fe819 closes odoo/odoo#51557 X-original-commit: 221470ab9c9eda3f3a4e2da0fa1a7bb23d6288cc Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/tests/test_views.py')
-rw-r--r--addons/website/tests/test_views.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/addons/website/tests/test_views.py b/addons/website/tests/test_views.py
index c662416756c..61415064eed 100644
--- a/addons/website/tests/test_views.py
+++ b/addons/website/tests/test_views.py
@@ -1310,7 +1310,18 @@ class TestThemeViews(common.TransactionCase):
self.assertEqual(specific_main_view_children.name, 'Test Child View', "Ensure theme.ir.ui.view has been loaded as an ir.ui.view into the website..")
self.assertEqual(specific_main_view_children.website_id, website_1, "..and the website is the correct one.")
- # 4. Keep User arch changes
+ # 4. Simulate theme update. Do it 2 time to make sure it was not interpreted as a user change the first time.
+ new_arch = '<xpath expr="//body" position="replace"><span>Odoo Change01</span></xpath>'
+ theme_view.arch = new_arch
+ test_theme_module.with_context(load_all_views=True)._theme_load(website_1)
+ self.assertEqual(specific_main_view_children.arch, new_arch, "First time: View arch should receive theme updates.")
+ self.assertFalse(specific_main_view_children.arch_updated)
+ new_arch = '<xpath expr="//body" position="replace"><span>Odoo Change02</span></xpath>'
+ theme_view.arch = new_arch
+ test_theme_module.with_context(load_all_views=True)._theme_load(website_1)
+ self.assertEqual(specific_main_view_children.arch, new_arch, "Second time: View arch should still receive theme updates.")
+
+ # 5. Keep User arch changes
new_arch = '<xpath expr="//body" position="replace"><span>Odoo</span></xpath>'
specific_main_view_children.arch = new_arch
theme_view.name = 'Test Child View modified'