Skip to content

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)


Complete URC management including:

  • New URC Registration
  • URC Loan Processing
  • Change of Dependency / Dual Dependency
  • Merger / De-merger
  • Termination / Temporary Suspension

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"
  • Create URCRegistration DocType
  • CS Directorate submission workflow
  • AGM Secretary approval
  • Auto-create URC on approval
  • Notify dependent Depot

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"
  • Create URCLoan DocType
  • Multi-level approval workflow (Depot → CS → IFA → CDA → BoA → F&A)
  • Book Keeper integration for disbursement
  • Stock allotment notification to Depot

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"
  • Create URCDependencyChange DocType
  • NOC request to old Depot
  • Auto-update URC on approval
  • Notify both Depots

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"
  • Create URCMerger DocType
  • Handle stock transfer on merger
  • Create new URCs on de-merger
  • Update all related records

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"
  • Create URCTermination DocType
  • Stock return workflow
  • Outstanding dues settlement
  • Update URC status (Suspended/Terminated)

# URC Registration
URCRegistrationWorkflow = 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 Loan
URCLoanWorkflow = 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"),
]
)

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

  • 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