forked from OCA/purchase-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.py
More file actions
35 lines (31 loc) · 985 Bytes
/
hooks.py
File metadata and controls
35 lines (31 loc) · 985 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
25
26
27
28
29
30
31
32
33
34
35
# Copyright 2024-Today - Sylvain Le GAL (GRAP)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
_logger = logging.getLogger(__name__)
def post_init_hook(cr, registry):
_logger.info("Initializing column discount1 on table purchase_order_line")
cr.execute(
"""
UPDATE purchase_order_line
SET discount1 = discount
WHERE discount != 0
"""
)
_logger.info("Initializing column discount1 on table product_supplierinfo")
cr.execute(
"""
UPDATE product_supplierinfo
SET discount1 = discount
WHERE discount != 0
"""
)
_logger.info(
"Initializing column default_supplierinfo_discount1 on table res_partner"
)
cr.execute(
"""
UPDATE res_partner
SET default_supplierinfo_discount1 = default_supplierinfo_discount
WHERE default_supplierinfo_discount != 0
"""
)