Single DocType to handle 3 types of stock movements in ERPNext factory operations: Material Receipt (receive stock into warehouse) Transfer to V8 (move stock to production line) Internal Transfer with Delivery Note (warehouse-to-warehouse with e-way bill) Goal: Replace manual Stock Entry + Delivery Note creation with one unified interface. FUNCTIONAL REQUIREMENTS 1. Transaction Types & Behavior Transaction Type Source WH Target WH Documents Created E-Way Bill Material Receipt None Required Stock Entry (Material Receipt) No Transfer to V8 Required Auto V8 Stock Entry (Material Transfer) No Internal Transfer Required Required Stock Entry + Delivery Note Yes* *E-way bill when value > ₹50,000 OR generate_eway_bill = YES 2. Core Fields Required Parent DocType: "Material Movement Entry" text MANDATORY FIELDS: ├── naming_series (MME-YYYY-MM-) ├── transaction_type (Select: 3 options above) ├── posting_date (Default: TODAY) ├── posting_time (Default: NOW) ├── company (Link: Company) └── target_warehouse (Link: Warehouse) CONDITIONAL FIELDS: ├── source_warehouse (Show for Transfer to V8 + Internal Transfer) ├── internal_customer (Show for Internal Transfer only) ├── generate_eway_bill (Show for Internal Transfer only) ├── transporter_name, vehicle_no, distance (E-way bill fields) └── items (Child table) READ-ONLY POST-SUBMIT: ├── stock_entry_reference ├── delivery_note_reference └── eway_bill_no Child Table: "Material Movement Item" text item_code, qty, uom, source_warehouse, target_warehouse, batch_no USER WORKFLOWS (Must Test These Exactly) Scenario 1: Material Receipt text User: Warehouse Staff 1. Select "Material Receipt" 2. Pick target_warehouse = "Raw Materials" 3. Add items: Steel Sheet (100 units) 4. Submit → Creates Stock Entry (Purpose: Material Receipt) Expected: Raw Materials stock +100 units Scenario 2: Transfer to V8 text User: Production Supervisor 1. Select "Transfer to V8" 2. Pick source_warehouse = "Raw Materials" 3. Target auto-fills "V8 Warehouse" 4. Add items: Steel Sheet (50 units) 5. Submit → Creates Stock Entry (Purpose: Material Transfer) Expected: Raw Materials -50, V8 +50 Scenario 3: Internal Transfer text User: Factory Manager 1. Select "Internal Transfer with Delivery Note" 2. source_warehouse = "Factory Floor" 3. target_warehouse = "Distribution Center" 4. internal_customer = "Distribution Center" (must be Internal Customer) 5. Check "Generate E-Way Bill" 6. Fill: transporter_name, vehicle_no, distance=45km 7. Add items: Finished Goods (1000 units, ₹75k value) 8. Submit → Creates 3 documents: ├── Stock Entry (Material Transfer) ├── Delivery Note (Internal Customer) └── E-Way Bill (auto-generated) if value 50000 + Expected: Stock moved + compliance docs created TECHNICAL REQUIREMENTS 1. DocType Settings text ✓ Is Submittable: YES ✓ Track Changes: YES ✓ Module: Stock ✓ Naming: By Naming Series (MME-YYYY-MM-) ✓ Permissions: Stock User, Stock Manager, Manufacturing User 2. Dynamic UI Rules (JavaScript) text if(transaction_type == "Material Receipt"): hide(source_warehouse, internal_customer, eway_bill fields) if(transaction_type == "Transfer to V8"): auto-fill(target_warehouse = "V8 Warehouse") show(source_warehouse only) if(transaction_type == "Internal Transfer"): show(source_warehouse, internal_customer, eway_bill section) 3. Backend Logic (Server Script - on_submit) text if(transaction_type == "Material Receipt"): create_stock_entry(purpose="Material Receipt", s_warehouse=None) elif(transaction_type == "Transfer to V8"): create_stock_entry(purpose="Material Transfer", s_warehouse=source, t_warehouse=V8) elif(transaction_type == "Internal Transfer"): create_stock_entry(purpose="Material Transfer") create_delivery_note(internal_customer) if(generate_eway_bill): create_eway_bill() 4. Validations (before_submit) text - Items table not empty - qty > 0 for all items - source_warehouse ≠ target_warehouse (for transfers) - Sufficient stock in source_warehouse (for transfers) - internal_customer has "is_internal_customer=1" (for Internal Transfer) - All e-way bill fields filled when generate_eway_bill=1 PRE-REQUISITES (Must Configure Before Development) Stock Settings text ✓ Enable "Allow Material Transfer From Delivery Note" Customer Setup text Create Customer: "Distribution Center" ✓ Check "Is Internal Customer" └─ Represents Company: Your Company Warehouse Setup text Must exist: ├── "Raw Materials - [Company]" ├── "V8 Production - [Company]" └── "Distribution Center - [Company]" DELIVERABLES EXPECTED text 1. Custom DocType: "Material Movement Entry" (fully functional) 2. Child DocType: "Material Movement Item" 3. Server Scripts (on_submit + before_submit) 4. Custom JavaScript (dynamic UI) 5. Permissions configured for 3 roles 6. All 3 scenarios fully tested with sample data 7. DocType JSON export file (for backup) 8. 30-min demo + handover training 9. Written testing checklist passed TESTING CRITERIA (Must Pass All) text [ ] Scenario 1: Material Receipt → Stock increases in target WH [ ] Scenario 2: Transfer to V8 → Stock moves source→V8 correctly [ ] Scenario 3: Internal Transfer → 3 documents created correctly [ ] Stock Ledger: All movements reflected accurately [ ] Cancel entries: Reverse stock movements work [ ] Permissions: Role-based access enforced [ ] Validations: All error cases handled [ ] UI: Fields show/hide correctly by transaction type [ ] Performance: Handles 100+ line items smoothly TIMELINE & MILESTONES text Day 1-2: DocType creation + basic fields Day 3: Backend server scripts Day 4: Frontend JavaScript + UI polish Day 5: Testing all 3 scenarios + bug fixes Day 6: Permissions + final testing Day 7: Demo + handover SUCCESS METRICS text Users can complete ANY stock movement in <2 minutes Zero manual Stock Entry/Delivery Note creation needed 100% GST compliance for internal transfers >₹50k Stock accuracy maintained 100% All 3 user roles can use without training NOTES FOR DEVELOPER text - Use Server Scripts (NO custom app needed for MVP) - Test in Developer Mode first - Use frappe.msgprint for user feedback - Handle all edge cases (empty items, zero qty, etc.) - E-way bill number can be simple random 12-digit for demo - Focus on UX: Hide irrelevant fields completely Budget Range: [Your budget] Timeline: 7 days max Platform: ERPNext v15+ (latest) Start with: Enable Developer Mode → Create DocType → Test Scenario 1 first.