-
Notifications
You must be signed in to change notification settings - Fork 51
/
hooks.py
33 lines (27 loc) · 923 Bytes
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2023 Emanuel Cino
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
from odoo import SUPERUSER_ID, api
def pre_init_hook(cr):
"""Loaded before installing the module.
None of this module's DB modifications will be available yet.
If you plan to raise an exception to abort install, put all code inside a
``with cr.savepoint():`` block to avoid broken databases.
:param odoo.sql_db.Cursor cr:
Database cursor.
"""
# This will avoid computing all values at module installation, which takes forever.
env = api.Environment(cr, SUPERUSER_ID, {})
openupgrade.add_fields(
env,
[
(
"event_id",
"account.move.line",
False,
"integer",
"integer",
"crm_compassion",
)
],
)