forked from OCA/credit-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.py
33 lines (30 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
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2022 ForgeFlow, S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import logging
_logger = logging.getLogger(__name__)
def pre_init_hook(cr):
_logger.info(
"Pre-creating column overdue_reminder_last_date for table account_move"
)
cr.execute(
"""
ALTER TABLE account_move
ADD COLUMN IF NOT EXISTS overdue_reminder_last_date Date;
"""
)
_logger.info("Pre-creating column overdue_reminder_counter for table account_move")
cr.execute(
"""
ALTER TABLE account_move
ADD COLUMN IF NOT EXISTS overdue_reminder_counter INTEGER DEFAULT 0;
ALTER TABLE account_move ALTER COLUMN overdue_reminder_counter DROP DEFAULT;
"""
)
_logger.info("Pre-creating column no_overdue_reminder for table account_move")
cr.execute(
"""
ALTER TABLE account_move
ADD COLUMN IF NOT EXISTS no_overdue_reminder BOOL DEFAULT False;
ALTER TABLE account_move ALTER COLUMN no_overdue_reminder DROP DEFAULT;
"""
)