Skip to content

Commit 02926cc

Browse files
[FIX] ir_config_parameter_multi_company: hook to avoid error with CRM
1 parent 64153a7 commit 02926cc

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Diff for: ir_config_parameter_multi_company/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import models
2+
from .hooks import pre_init_hook

Diff for: ir_config_parameter_multi_company/__manifest__.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
"data": ["views/ir_config_parameter_view.xml", "security/parameter_security.xml"],
1212
"images": [],
1313
"installable": True,
14+
"pre_init_hook": "pre_init_hook",
1415
}

Diff for: ir_config_parameter_multi_company/hooks.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# # Copyright 2019 ACSONE SA/NV
2+
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
import logging
4+
5+
_logger = logging.getLogger(__name__)
6+
7+
8+
def pre_init_hook(cr):
9+
_logger.info("Pre-creating column company_id for table ir_config_parameter")
10+
cr.execute(
11+
"""
12+
ALTER TABLE ir_config_parameter
13+
ADD COLUMN IF NOT EXISTS company_id INTEGER;
14+
"""
15+
)

0 commit comments

Comments
 (0)