Phase 08: URC Lifecycle Management
Duration: 2 days Goal: Implement full URC lifecycle per DPR Sections 3.1 (AGM Secretary) and 3.2 (CS Directorate)
Overview
Section titled “Overview”Complete URC management including:
- New URC Registration
- URC Loan Processing
- Change of Dependency / Dual Dependency
- Merger / De-merger
- Termination / Temporary Suspension
1. URC Registration Workflow
Section titled “1. URC Registration Workflow”1.1 URC Registration Request
Section titled “1.1 URC Registration Request”class URCRegistration(BaseDocType): """New URC registration request from CS Directorate."""
# Basic Info proposed_name: str = Field(max_length=200) unit_name: str # Military unit formation: str # Army, Navy, Air Force, etc.
# Location address: str city: str state: str pincode: str
# Commanding Officer Details co_name: str co_rank: str co_contact: str
# Proposed Depot proposed_depot: str # FK to Depot secondary_depot: str | None = None # For dual dependency
# CS Directorate cs_directorate: str cs_approval_date: date | None = None
# Workflow status: str = "Draft" # Draft, CS Approved, AGM Review, Approved, Rejected
# Result urc_code: str | None = None # Assigned on approval registration_number: str | None = None
class Meta: table_name = "urc_registration" workflow = "URCRegistrationWorkflow"1.2 Tasks
Section titled “1.2 Tasks”- Create
URCRegistrationDocType - CS Directorate submission workflow
- AGM Secretary approval
- Auto-create URC on approval
- Notify dependent Depot
2. URC Loan Processing
Section titled “2. URC Loan Processing”class URCLoan(BaseDocType): """Loan request from URC for initial stock."""
urc: str # FK to URC
# Loan Details requested_amount: Decimal purpose: str # Initial Stock, Expansion, etc.
# Processing depot_recommendation: str | None = None # Approve/Reject depot_remarks: str | None = None
cs_directorate_approval: bool = False cs_approval_amount: Decimal | None = None
# IFA/CDA Review ifa_cleared: bool = False cda_cleared: bool = False
# BoA Decision boa_decision: str = "Pending" # Pending, Approved, Rejected approved_amount: Decimal | None = None
# Disbursement (F&A) disbursement_date: date | None = None disbursement_reference: str | None = None
# Status status: str = "Draft"
class Meta: table_name = "urc_loan" workflow = "URCLoanWorkflow"2.1 Tasks
Section titled “2.1 Tasks”- Create
URCLoanDocType - Multi-level approval workflow (Depot → CS → IFA → CDA → BoA → F&A)
- Book Keeper integration for disbursement
- Stock allotment notification to Depot
3. Change of Dependency
Section titled “3. Change of Dependency”class URCDependencyChange(BaseDocType): """Request to change URC's dependent Depot."""
urc: str # FK to URC
# Current current_depot: str # FK to Depot current_secondary_depot: str | None = None
# Proposed new_depot: str # FK to Depot new_secondary_depot: str | None = None # Dual dependency
# Reason reason: str effective_date: date
# NOC old_depot_noc: bool = False old_depot_noc_date: date | None = None noc_document: str | None = None # FK to File
# Approval agm_approval: bool = False
# Status status: str = "Draft" # Draft, NOC Pending, NOC Received, Approved
class Meta: table_name = "urc_dependency_change"3.1 Tasks
Section titled “3.1 Tasks”- Create
URCDependencyChangeDocType - NOC request to old Depot
- Auto-update URC on approval
- Notify both Depots
4. Merger / De-merger
Section titled “4. Merger / De-merger”class URCMerger(BaseDocType): """URC merger or de-merger request."""
request_type: str # Merger, De-merger
# For Merger: Multiple URCs → One merging_urcs: list[str] = Field(default_factory=list) # URC IDs surviving_urc: str | None = None # Which URC continues
# For De-merger: One URC → Multiple parent_urc: str | None = None new_urc_count: int = 0
# CS Directorate cs_directorate: str cs_recommendation: str | None = None
# NOC depot_noc_required: bool = True depot_noc_received: bool = False
# AGM Approval agm_decision: str = "Pending" effective_date: date | None = None
# Status status: str = "Draft"
class Meta: table_name = "urc_merger"4.1 Tasks
Section titled “4.1 Tasks”- Create
URCMergerDocType - Handle stock transfer on merger
- Create new URCs on de-merger
- Update all related records
5. Termination / Suspension
Section titled “5. Termination / Suspension”class URCTermination(BaseDocType): """URC termination or temporary suspension."""
urc: str # FK to URC action_type: str # Termination, Temporary Suspension
# Reason reason: str initiated_by: str # CS Directorate, AGM, etc.
# For Suspension suspension_start: date | None = None suspension_end: date | None = None # If temporary
# Settlement outstanding_dues: Decimal = Decimal("0") stock_value: Decimal = Decimal("0") settlement_status: str = "Pending" # Pending, Settled
# NOC depot_noc: bool = False rm_noc: bool = False
# Approval cs_approval: bool = False agm_approval: bool = False
# Status status: str = "Draft"
class Meta: table_name = "urc_termination"5.1 Tasks
Section titled “5.1 Tasks”- Create
URCTerminationDocType - Stock return workflow
- Outstanding dues settlement
- Update URC status (Suspended/Terminated)
6. Workflow Definitions
Section titled “6. Workflow Definitions”# URC RegistrationURCRegistrationWorkflow = Workflow( states=["Draft", "CS Review", "CS Approved", "AGM Review", "Approved", "Rejected"], transitions=[ ("Submit to CS", "Draft", "CS Review"), ("CS Approve", "CS Review", "CS Approved"), ("Submit to AGM", "CS Approved", "AGM Review"), ("Approve", "AGM Review", "Approved"), ("Reject", "AGM Review", "Rejected"), ])
# URC LoanURCLoanWorkflow = Workflow( states=["Draft", "Depot Review", "CS Review", "IFA Review", "CDA Review", "BoA Pending", "F&A Processing", "Disbursed", "Rejected"], transitions=[ ("Submit", "Draft", "Depot Review"), ("Depot Approve", "Depot Review", "CS Review"), ("CS Approve", "CS Review", "IFA Review"), ("IFA Clear", "IFA Review", "CDA Review"), ("CDA Clear", "CDA Review", "BoA Pending"), ("BoA Approve", "BoA Pending", "F&A Processing"), ("Disburse", "F&A Processing", "Disbursed"), ("Reject", "*", "Rejected"), ])7. API Endpoints
Section titled “7. API Endpoints”| Endpoint | Method | Description |
|---|---|---|
/api/v1/urc-registration |
POST | New registration request |
/api/v1/urc-loan |
POST | Loan application |
/api/v1/urc-dependency-change |
POST | Change dependency |
/api/v1/urc-merger |
POST | Merger/de-merger request |
/api/v1/urc-termination |
POST | Termination/suspension |
/api/v1/urc/{id}/suspend |
POST | Quick suspension |
/api/v1/urc/{id}/reinstate |
POST | Reinstate suspended URC |
8. Verification Checklist
Section titled “8. Verification Checklist”- Complete registration flow (CS → AGM → URC created)
- Loan disbursement with Book Keeper entry
- Dependency change with NOC workflow
- Merger consolidates stock correctly
- Termination settles dues
- All stakeholders notified at each stage