forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdata_product_migration.py
More file actions
32 lines (32 loc) · 855 Bytes
/
data_product_migration.py
File metadata and controls
32 lines (32 loc) · 855 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
env = locals().get("env")
# packaging that should be assigned existing UOM
product = env.ref("product.product_delivery_01")
packaging = env["product.packaging"].create(
{
"name": "Sixpack",
"barcode": "42 42",
"product_id": product.id,
"qty": 6,
}
)
# packaging that should have a new UOM created
product = env.ref("product.product_delivery_01")
packaging = env["product.packaging"].create(
{
"name": "Thirteenpack",
"barcode": "42 43",
"product_id": product.id,
"qty": 13,
}
)
# packaging that should reuse UOM created for the one above
product = env.ref("product.product_delivery_02")
packaging = env["product.packaging"].create(
{
"name": "Thirteenpack",
"barcode": "42 44",
"product_id": product.id,
"qty": 13,
}
)
env.cr.commit()