Add Stage 6 CSV templates for Frappe's native Data Import tool
Replaces fully-manual Desk UI click-through for Item Groups/Warehouses/ Items with three fillable CSV templates imported via Frappe's own Data Import tool (New Data Import -> Insert New Records -> upload -> Start Import) -- no code, no custom app, consistent with this project's native-only philosophy. Headers are not hand-typed or guessed: generated directly from this exact ERPNext version's own Exporter class (the same code download_template uses) via bench console against the running instance, including the Item Reorder child table's "Field Label (Parent Table Label)" column convention for Reorder Level/Qty -- confirmed by inspecting Exporter.get_all_exportable_fields' source, since a child-table key must be the parent's fieldname (reorder_levels), not the child doctype name (Item Reorder), which silently produces zero columns if gotten wrong. Followed up from a user question about cloning a site as a template to skip reprovisioning -- assessed as unclean (Setup Wizard's company data can't be cleanly redone on a clone, template would need to stay permanently free of demo/real data) and recommended templating Stage 6 instead, since it's just data entry, not Frappe system state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
This commit is contained in:
parent
cde7dbd4c6
commit
3224e5f2fa
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
`<Your Company Name>` 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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
Item Group Name,Parent Item Group,Is Group
|
||||
Consumable Parts,All Item Groups,0
|
||||
Tools & Equipment,All Item Groups,0
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Warehouse Name,Company,Parent Warehouse,Is Group Warehouse
|
||||
Main Store,<Your Company Name>,,0
|
||||
<Property or Site Name>,<Your Company Name>,,0
|
||||
Damaged,<Your Company Name>,,0
|
||||
|
Loading…
Reference in New Issue