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
28 lines (27 loc) · 818 Bytes
/
hooks.py
File metadata and controls
28 lines (27 loc) · 818 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
def post_init_hook(env):
env.cr.execute(
"""
UPDATE purchase_order_line upd
SET discount1=pol.discount
FROM (SELECT *
FROM purchase_order_line
WHERE discount IS NOT NULL
AND discount1 IS NULL
AND discount2 IS NULL
AND discount3 IS NULL) as pol
WHERE upd.id = pol.id
"""
)
env.cr.execute(
"""
UPDATE product_supplierinfo upd
SET discount1=psi.discount
FROM (SELECT *
FROM product_supplierinfo
WHERE discount IS NOT NULL
AND discount1 IS NULL
AND discount2 IS NULL
AND discount3 IS NULL) as psi
WHERE upd.id = psi.id
"""
)