Docs: template Excel import produk & kategori + panduan README
This commit is contained in:
24
templates/README-IMPORT.md
Normal file
24
templates/README-IMPORT.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Template Import Odoo
|
||||||
|
|
||||||
|
Folder ini berisi contoh file template untuk import master data ke Odoo ERP.
|
||||||
|
|
||||||
|
## Isi Folder
|
||||||
|
| File | Kegunaan |
|
||||||
|
|---|---|
|
||||||
|
| `import-products.xlsx` | Template import produk (Product Name, Category, Price, Cost, Barcode) |
|
||||||
|
| `import-product-categories.xlsx` | Template import kategori produk (Name + Parent Category) |
|
||||||
|
| `import-product-categories.csv` | Versi CSV kategori (untuk referensi/format cepat) |
|
||||||
|
|
||||||
|
## Cara Pakai
|
||||||
|
1. **Kategori dulu, baru Produk** (Produk butuh kategori yang sudah ada).
|
||||||
|
2. Buka Odoo → **Inventory/Sales → Configuration → Product Categories** → tombol **Import**.
|
||||||
|
- Petakan: `Nama Kategori` → `Name`, `Parent Category` → `Parent Category`.
|
||||||
|
3. Setelah kategori masuk, `code` 2-digit otomatis terisi oleh addon.
|
||||||
|
4. Buka **Inventory/Sales → Products → Products** → tombol **Import**.
|
||||||
|
- Petakan: `Product Name` → `Name`, `Product Category` → `Product Category`, dll.
|
||||||
|
5. **Jangan isi** kolom `Item Code`/`Internal Reference` — otomatis di-generate addon.
|
||||||
|
- Format: `parent_code + child_code + product_id(4) + nama_lowercase_tanpa_spasi (koma → titik)`.
|
||||||
|
|
||||||
|
## Contoh hasil otomatis
|
||||||
|
- Kategori `Elektronik` (code `01`), kategori `Laptop` (code `04`, parent `Elektronik`), produk `MacBook Air M2` (id `0001`):
|
||||||
|
- `item_code = 01040001macbookairm2`
|
||||||
60
templates/generate_templates.py
Normal file
60
templates/generate_templates.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Generate template Excel untuk import produk & kategori Odoo."""
|
||||||
|
from openpyxl import Workbook
|
||||||
|
from openpyxl.styles import Font, PatternFill, Alignment
|
||||||
|
|
||||||
|
HEADER_FILL = PatternFill('solid', fgColor='0B6E4F')
|
||||||
|
HEADER_FONT = Font(bold=True, color='FFFFFF')
|
||||||
|
|
||||||
|
def styled_header(ws, headers):
|
||||||
|
ws.append(headers)
|
||||||
|
for cell in ws[1]:
|
||||||
|
cell.fill = HEADER_FILL
|
||||||
|
cell.font = HEADER_FONT
|
||||||
|
cell.alignment = Alignment(horizontal='center')
|
||||||
|
|
||||||
|
# ---------- 1. Template Produk ----------
|
||||||
|
wb = Workbook()
|
||||||
|
ws = wb.active
|
||||||
|
ws.title = 'Products'
|
||||||
|
styled_header(ws, ['Product Name', 'Product Category', 'Sales Price', 'Cost', 'Barcode'])
|
||||||
|
|
||||||
|
rows = [
|
||||||
|
['iPhone 15 128GB', 'Smartphone', 15000000, 12000000, 1234567890123],
|
||||||
|
['Samsung Galaxy S24', 'Smartphone', 14000000, 11000000, 1234567890124],
|
||||||
|
['MacBook Air M2', 'Laptop', 25000000, 20000000, 1234567890125],
|
||||||
|
['Wireless Mouse', 'Mouse', 500000, 350000, 1234567890126],
|
||||||
|
['Mechanical Keyboard', 'Keyboard', 750000, 500000, 1234567890127],
|
||||||
|
]
|
||||||
|
for r in rows:
|
||||||
|
ws.append(r)
|
||||||
|
|
||||||
|
widths = [22, 18, 13, 13, 16]
|
||||||
|
for i, w in enumerate(widths, 1):
|
||||||
|
ws.column_dimensions[chr(64 + i)].width = w
|
||||||
|
|
||||||
|
wb.save('/home/ardhi/Application/odoo-erp/templates/import-products.xlsx')
|
||||||
|
print('OK: import-products.xlsx')
|
||||||
|
|
||||||
|
# ---------- 2. Template Kategori ----------
|
||||||
|
wb2 = Workbook()
|
||||||
|
ws2 = wb2.active
|
||||||
|
ws2.title = 'Categories'
|
||||||
|
styled_header(ws2, ['Nama Kategori', 'Parent Category'])
|
||||||
|
|
||||||
|
cat_rows = [
|
||||||
|
['Elektronik', ''],
|
||||||
|
['Smartphone', 'Elektronik'],
|
||||||
|
['Laptop', 'Elektronik'],
|
||||||
|
['Aksesoris', ''],
|
||||||
|
['Mouse', 'Aksesoris'],
|
||||||
|
['Keyboard', 'Aksesoris'],
|
||||||
|
]
|
||||||
|
for r in cat_rows:
|
||||||
|
ws2.append(r)
|
||||||
|
|
||||||
|
ws2.column_dimensions['A'].width = 22
|
||||||
|
ws2.column_dimensions['B'].width = 22
|
||||||
|
|
||||||
|
wb2.save('/home/ardhi/Application/odoo-erp/templates/import-product-categories.xlsx')
|
||||||
|
print('OK: import-product-categories.xlsx')
|
||||||
7
templates/import-product-categories.csv
Normal file
7
templates/import-product-categories.csv
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Nama Kategori,Parent Category
|
||||||
|
Elektronik,
|
||||||
|
Smartphone,Electronics
|
||||||
|
Laptop,Electronics
|
||||||
|
Aksesoris,
|
||||||
|
Mouse,Aksesoris
|
||||||
|
Keyboard,Aksesoris
|
||||||
|
BIN
templates/import-product-categories.xlsx
Normal file
BIN
templates/import-product-categories.xlsx
Normal file
Binary file not shown.
BIN
templates/import-products.xlsx
Normal file
BIN
templates/import-products.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user