-
Notifications
You must be signed in to change notification settings - Fork 3
/
hooks.py
59 lines (39 loc) · 1.54 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
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 openerp.sql_db.Cursor cr:
Database cursor.
"""
raise NotImplementedError
def post_init_hook(cr, registry):
"""Loaded after installing the module.
This module's DB modifications will be available.
:param openerp.sql_db.Cursor cr:
Database cursor.
:param openerp.modules.registry.RegistryManager registry:
Database registry, using v7 api.
"""
raise NotImplementedError
def uninstall_hook(cr, registry):
"""Loaded before uninstalling the module.
This module's DB modifications will still be available. Raise an exception
to abort uninstallation.
:param openerp.sql_db.Cursor cr:
Database cursor.
:param openerp.modules.registry.RegistryManager registry:
Database registry, using v7 api.
"""
raise NotImplementedError
def post_load():
"""Loaded before any model or data has been initialized.
This is ok as the post-load hook is for server-wide
(instead of registry-specific) functionalities.
This is very useful to create monkey patches for odoo.
Note: You do not have access to database cursor here.
"""
raise NotImplementedError