---
type: redmine-readme
project: Endress + Hauser
subject: Wizard Items table on the native Frappe grid
story_key: dc-wizard-items-native-grid
generated_at: 2026-10-16T16:56:59+05:30
story_type: feature
---

# Wizard Items table on the native Frappe grid

> The wizard's Items step uses Frappe's own child-table grid, with live GST and total calculation and product autofill.

## 1. Summary
The first Items step was an HTML table with a free-text product field, wrong GST and total values, and part details shown as IDs. This feature replaces it with a standard Frappe grid built from `frappe.ui.form.make_control` (`NativeItemsGrid` in `dc_wizard_common.js`). Rows recalculate taxable value, tax and total as the user types, a product choice fills Description and HSN from Product Master, and rows that come from a predecessor DC are locked except Qty. The grid also has CSV template download and upload. Built 10 Sep, polished on 15 Sep, committed in `eb17760`. The GST Rate and Tax Category change on this grid is tracked in `dc-wizard-tax-category-gst-rate`.

## 2. Requirement
| # | Requirement | Source | Status |
|---|---|---|---|
| R1 | Product must be a Link field; use the standard Frappe child-table component, not an HTML table | User, 10 Sep (said twice) | Done |
| R2 | GST values and totals must be captured correctly | User, 10 Sep | Done |
| R3 | Show names instead of IDs for part details | User, 10 Sep | Done |
| R4 | Qty validation against the outstanding quantity in real time on return rows | User, 10 Sep | Done |
| R5 | Download and Upload template buttons must look identical | User, 11 Sep | Done |
| R6 | Item table to look better ("make it more better") | User, 15 Sep | Done |

## 3. Decisions
| Decision | Options considered | Why this one | Date |
|---|---|---|---|
| Use Frappe's grid via `make_control`, not a custom table | HTML table; a DataTable | The user asked twice for the standard child-table component | 2026-09-10 |
| Upload and Download are both real `<button>` elements; Upload triggers a hidden file input | Keep Upload as a styled `<label>` | A height rule applied only to `button`, leaving the label 8px different | 2026-09-11 |
| Rows copied from a predecessor DC are locked except Qty | Fully editable | Return quantities must stay tied to the source row | 2026-09-10 |

## 4. Logic & Workflow
1. Each row has Item (Link), Description, HSN, Qty, UOM, Unit Cost and the tax and total columns.
2. Changing Qty, Unit Cost or a rate recomputes the row and the running totals shown under the grid.
3. Picking a product fills Description and HSN from Product Master.
4. On a locked row a Qty above `outstanding_qty` warns immediately and blocks Next.
5. CSV template download and upload replace the rows; unknown columns are rejected.

## 5. Files & Components Changed
| File / DocType / Fixture | Type | Change | Purpose |
|---|---|---|---|
| canofy_custom_eh/public/js/dc_wizard_common.js | Shared JS | New | `NativeItemsGrid`, bulk CSV fill, totals |
| canofy_custom_eh/canofy_custom_eh/page/delivery_challan_wizard/delivery_challan_wizard.js | Page JS | New | Items step and validation |
| canofy_custom_eh/public/css/dc_wizard.css | CSS | Changed | Grid and button styling |

## 6. Configuration & Deployment
No settings. Build assets and clear cache after changes.

## 7. Testing
| Test | Data / Site | Expected | Actual | Status |
|---|---|---|---|---|
| Items grid and CSV cases | E2E suite, 5 Oct | TC-019 to TC-041 pass | Pass | PASS |
| Return-row locking and Qty limit | E2E suite, 5 Oct | TC-090, TC-091 pass | Pass | PASS |
| Template buttons same height | Playwright, 11 Sep | Equal height | Both 24.8px | PASS |

## 8. Known Limitations & Open Items
- CSV bulk fill applies to editable fields only; derived tax columns are not part of the template.

## 9. Status
| Item | Value |
|---|---|
| Branch | claude/delivery-challan-wizard-bcb464 |
| Commits | `eb17760` (grid); later polish on 15 Sep reached `9c93020` or the working tree. Not confirmed which |
| PR | Not confirmed |
| Version | Not confirmed |
| Deployed to | Local dev site only |

## 10. References
- Related: `dc-wizard-guided-flow`, `dc-wizard-tax-category-gst-rate`
