diff --git a/CLAUDE.md b/CLAUDE.md index 731cd14..e1760b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -81,7 +81,10 @@ sightbox/ ├── provisioning/ ← every native customization from INSTALLATION_PLAYBOOK.md, │ ├── provision_client.py replayed onto a fresh site in one idempotent pass │ ├── provision_client.sh (Installation Playbook Stage 5) -│ └── bettersight_logo.png +│ ├── bettersight_logo.png +│ └── templates/ Stage 6's CSV templates (Item Group/Warehouse/Item) for +│ (3 files) Frappe's native Data Import tool — headers generated from +│ this ERPNext version's own Exporter, not hand-typed ├── backend/ ← the ONLY custom code in this project │ ├── app.py │ ├── Dockerfile diff --git a/playbook/INSTALLATION_PLAYBOOK.md b/playbook/INSTALLATION_PLAYBOOK.md index 10b853d..2ba07fd 100644 --- a/playbook/INSTALLATION_PLAYBOOK.md +++ b/playbook/INSTALLATION_PLAYBOOK.md @@ -343,13 +343,40 @@ methodology lives for building *new* customizations beyond what's listed here. ## Stage 6 — Stock module foundation (client-specific — stays manual) The provisioning script deliberately does not touch this — it's real business data, not a -generic customization. Per the training guide's Implementation Steps: -- **Item Groups**: Consumable Parts, Tools & Equipment (parent: All Item Groups) -- **Warehouses**: Main Store, plus one per leased property and one per active construction site, - plus a **Damaged** warehouse — damaged tools get transferred here (not written off outright) - so they stay trackable while a repair-or-replace decision gets made -- **Items**: `has_serial_no` + a `serial_no_series` pattern (e.g. `TOOL-.#####`) on Tools & - Equipment only; Reorder Level/Qty on Consumable Parts that need auto-reordering +generic customization. But "manual" doesn't mean clicking through Desk one field at a time: +Frappe's own **Data Import** tool (Desk → search "Data Import" → New Data Import) bulk-creates +records from a CSV, no code or custom app involved. Three starter templates ship in +[`provisioning/templates/`](../provisioning/templates/) — copy each one, fill in this client's +real names, and import in this order (later ones reference earlier ones): + +1. **[`item_groups_template.csv`](../provisioning/templates/item_groups_template.csv)** — + Consumable Parts, Tools & Equipment (parent: All Item Groups). Import against **Item Group**. +2. **[`warehouses_template.csv`](../provisioning/templates/warehouses_template.csv)** — + Main Store, plus one per leased property and one per active construction site, plus a + **Damaged** warehouse — damaged tools get transferred here (not written off outright) so they + stay trackable while a repair-or-replace decision gets made. Replace + `` with the exact company name from Stage 3's Setup Wizard. Import against + **Warehouse** — leave `Warehouse Name` plain (e.g. `Main Store`); ERPNext appends the + company abbreviation itself (`Main Store - JPT`) on creation, the template doesn't need to. +3. **[`items_template.csv`](../provisioning/templates/items_template.csv)** — `has_serial_no` + + a `serial_no_series` pattern (e.g. `TOOL-.#####`) on Tools & Equipment only; Reorder + Level/Qty (the trailing four columns, via the **Item Reorder** child table) on Consumable + Parts that need auto-reordering — leave those four blank on serialized tool rows, as in the + template's own example. Import against **Item**. + +For each: Desk → **Data Import** → New Data Import → select the Doctype above → **Insert New +Records** → upload the filled-in CSV → **Start Import**. + +⚠ **Confirmed against this exact ERPNext version — these are not guessed header names.** Every +column header above was generated from Frappe's own `Exporter` class (the same code +`download_template` uses), not typed from memory: a mismatched header silently fails to map +during import rather than erroring clearly, so hand-typing these is genuinely risky on a version +bump. If `ERPNEXT_VERSION` ever changes, regenerate and diff the headers before trusting these +templates again — from `bench console`: +```python +from frappe.core.doctype.data_import.exporter import Exporter +Exporter("Item", export_fields={"Item": ["item_code", "..."]}, export_data=False, file_type="CSV").get_csv_array_for_export()[0] +``` ## Stage 7 — Email delivery & the scheduler diff --git a/provisioning/templates/item_groups_template.csv b/provisioning/templates/item_groups_template.csv new file mode 100644 index 0000000..e2bd641 --- /dev/null +++ b/provisioning/templates/item_groups_template.csv @@ -0,0 +1,3 @@ +Item Group Name,Parent Item Group,Is Group +Consumable Parts,All Item Groups,0 +Tools & Equipment,All Item Groups,0 diff --git a/provisioning/templates/items_template.csv b/provisioning/templates/items_template.csv new file mode 100644 index 0000000..d3e7e72 --- /dev/null +++ b/provisioning/templates/items_template.csv @@ -0,0 +1,3 @@ +Item Code,Item Name,Item Group,Default Unit of Measure,Maintain Stock,Has Serial No,Serial Number Series,Request for (Reorder level based on Warehouse),Re-order Level (Reorder level based on Warehouse),Re-order Qty (Reorder level based on Warehouse),Material Request Type (Reorder level based on Warehouse) +Cordless Drill - DeWalt 20V,Cordless Drill - DeWalt 20V,Tools & Equipment,Nos,1,1,TOOL-.#####,,,, +PVC Pipe Fitting 1/2in,PVC Pipe Fitting 1/2in,Consumable Parts,Nos,1,0,,Main Store,20,50,Purchase diff --git a/provisioning/templates/warehouses_template.csv b/provisioning/templates/warehouses_template.csv new file mode 100644 index 0000000..6cfdf87 --- /dev/null +++ b/provisioning/templates/warehouses_template.csv @@ -0,0 +1,4 @@ +Warehouse Name,Company,Parent Warehouse,Is Group Warehouse +Main Store,,,0 +,,,0 +Damaged,,,0