forked from OCA/product-attribute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.py
17 lines (15 loc) · 672 Bytes
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
def pre_init_hook(cr):
cr.execute("""ALTER TABLE product_product
ADD COLUMN manual_default_code VARCHAR""")
cr.execute("""UPDATE product_product
SET manual_default_code = default_code""")
cr.execute("""ALTER TABLE product_template
ADD COLUMN prefix_code VARCHAR""")
cr.execute("""UPDATE product_template
SET prefix_code = default_code
FROM product_product
WHERE product_template.id = product_product.product_tmpl_id""")