forked from OCA/e-commerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.py
22 lines (20 loc) · 1.04 KB
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright (C) 2020 Alexandre Díaz - Tecnativa S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID, api
from odoo.tools import config
def post_init_hook(cr, registry):
# This is here to not broke the tests. The idea:
# - XML changes in website are made using 'customize_show=True'
# - When Odoo is running in testing mode, we disable our changes
# - When run our test, we enable the changes and test it. (see test file)
#
# For the user it has no impact (only more customizable options in the website)
# For CI/CD avoids problems testing modules that removes/positioning elements
# that other modules uses in their tests.
if config["test_enable"] or config["test_file"]:
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
env.ref("website_sale_suggest_create_account.cart").active = False
env.ref(
"website_sale_suggest_create_account.short_cart_summary"
).active = False