forked from OCA/stock-logistics-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.py
More file actions
24 lines (21 loc) · 685 Bytes
/
hooks.py
File metadata and controls
24 lines (21 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tools.sql import column_exists
def pre_init_hook(env):
if not column_exists(env.cr, "stock_move", "actual_date"):
env.cr.execute(
"""
ALTER TABLE stock_move
ADD COLUMN actual_date DATE;
UPDATE stock_move
SET actual_date = DATE(date);
"""
)
env.cr.execute(
"""
ALTER TABLE stock_move_line
ADD COLUMN actual_date DATE;
UPDATE stock_move_line
SET actual_date = DATE(date);
"""
)