60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
# Demo Dataset Script for UAT Phase
|
|
# Installs sample raw materials, bulk inventory, and finished goods to test all 4 weeks of features.
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
env = env(user=SUPERUSER_ID)
|
|
|
|
# 1. Create a dummy test UoM (if needed) or use standard
|
|
kg_uom = env.ref('uom.product_uom_kgm').id
|
|
unit_uom = env.ref('uom.product_uom_unit').id
|
|
|
|
print("Generating Demo Products...")
|
|
|
|
prod_bulk = env['product.product'].create({
|
|
'name': '[DEMO-100] Turmeric Bulk Sack',
|
|
'type': 'product',
|
|
'tracking': 'lot',
|
|
'uom_id': kg_uom,
|
|
'uom_po_id': kg_uom,
|
|
'list_price': 150.0,
|
|
'standard_price': 120.0,
|
|
})
|
|
|
|
prod_retail = env['product.product'].create({
|
|
'name': '[DEMO-200] Turmeric Retail Bag 500g',
|
|
'type': 'product',
|
|
'tracking': 'lot',
|
|
'uom_id': unit_uom,
|
|
'uom_po_id': unit_uom,
|
|
'list_price': 5.0,
|
|
'standard_price': 2.5,
|
|
})
|
|
|
|
prod_byproduct = env['product.product'].create({
|
|
'name': '[DEMO-300] Turmeric Stems / Core',
|
|
'type': 'product',
|
|
'tracking': 'none',
|
|
'uom_id': kg_uom,
|
|
'uom_po_id': kg_uom,
|
|
'list_price': 0.5,
|
|
'standard_price': 0.1,
|
|
})
|
|
|
|
print("Generating Demo BOM Structure...")
|
|
bom = env['mrp.bom'].create({
|
|
'product_tmpl_id': prod_retail.product_tmpl_id.id,
|
|
'product_qty': 200, # 100 kg of bulk = 200 bags of 500g
|
|
'type': 'normal',
|
|
'bom_line_ids': [(0, 0, {
|
|
'product_id': prod_bulk.id,
|
|
'product_qty': 100,
|
|
'product_uom_id': kg_uom,
|
|
})]
|
|
})
|
|
|
|
# NOTE: Custom output products (Byproducts) can be dynamically linked through testing manually
|
|
# due to varying implementations (standard odoo byproduct vs custom c2c_multi_output_bom)
|
|
|
|
print("✅ Demo Data Successfully Generated!")
|
|
env.cr.commit()
|