An erpnext security gate module for recording material and people movement
Demo Video: https://drive.google.com/file/d/1mzmrLoa4C1H7ZSi5jn5PSRyO7kTLzZwh/view?usp=drive_link
You can install this app using the bench CLI:
- ERPNext Installed
- India Compliance Installed
cd $PATH_TO_YOUR_BENCH
bench get-app $URL_OF_THIS_REPO --branch develop
bench install-app gate_entry- Assign the auto-created
Security Guardrole to guard users. The setup hooks harden this role with read-only access toSales Invoice,Delivery Note, andGST Settings, while keeping Desk access disabled. - Ensure outbound sales documents capture transport details: add or expose
vehicle_number,driver_name, anddriver_contactfields onSales InvoiceandDelivery Noteso the gate pass can auto-populate them. - Review
GST Settingsand configuree_waybill_threshold(andenable_e_waybill_from_dnif Delivery Notes should be blocked) to align compliance checks with your statutory requirements. - Keep guard users on the streamlined Gate Pass form; they should not require additional financial roles or report permissions.
The Gate Entry app integrates seamlessly with ERPNext Stock Entry to automate gate pass creation for material transfers that leave the plant.
-
Auto-Creation of Gate Passes
- When a Stock Entry with
stock_entry_type = "Material Transfer"is submitted with theExternal Transfercheckbox enabled, a draft Gate Pass is automatically created - The Gate Pass is created in the background via an enqueued job to avoid blocking Stock Entry submission
- Gate Passes are also auto-created for
Send to SubcontractorStock Entries
- When a Stock Entry with
-
External Transfer Checkbox
- A custom field
ge_external_transferis added to Stock Entry - Visible only when
stock_entry_type == "Material Transfer" - When checked, indicates that the material transfer leaves the plant and requires gate documentation
- Optional
ge_gate_pass_instructionfield allows stores teams to pass notes to security
- A custom field
-
Return Material Transfers
- Return Stock Entries (
is_return = 1) automatically create inbound Gate Passes (Gate In) - The Gate Pass correctly links to the original outbound transfer via
outbound_material_transferfield - Manual return flow: Gate Passes can be created before the return Stock Entry exists, referencing the outbound transfer directly
- Return Stock Entries (
-
Multi-Pass Allocations
- Multiple Gate Passes can be created for the same Stock Entry to handle partial dispatches
- Allocation validation ensures total quantities across all Gate Passes do not exceed Stock Entry quantities
- Database-level locking prevents race conditions when multiple Gate Passes are validated simultaneously
-
Discrepancy Logging
- Gate Passes support recording material discrepancies (lost, damaged quantities)
- Validation ensures discrepancy quantities do not exceed movement quantities
- Discrepancy fields are automatically cleared when
has_discrepancyis unchecked
-
Cancellation Handling
- When a Stock Entry is cancelled, all linked Gate Pass references are automatically cleared
- Auto-created Gate Passes are cancelled when their source Stock Entry is cancelled
- Gate Passes can be cancelled independently, clearing the
gate_passreference from Stock Entry
Outbound Transfer:
- Create Stock Entry with
stock_entry_type = "Material Transfer" - Check
External Transfercheckbox - Submit Stock Entry
- Gate Pass is auto-created in draft status (Gate Out)
- Security guard reviews and submits Gate Pass
Return Transfer:
- Create return Stock Entry (
is_return = 1) referencing original outbound transfer - Submit return Stock Entry
- Gate Pass is auto-created in draft status (Gate In)
- Gate Pass automatically links to original outbound transfer
- Security guard reviews and submits Gate Pass
Manual Return Flow:
- Create Gate Pass manually with
manual_return_flow = 1 - Reference the outbound Stock Entry in
outbound_material_transfer - Submit Gate Pass
- Later, create return Stock Entry and link it to the Gate Pass
The app adds the following custom fields to Stock Entry (all removed on uninstall):
ge_external_transfer(Check): Flags external transfers requiring gate documentationge_gate_pass_instruction(Small Text): Optional notes for security teamgate_pass(Link): Links to the Gate Pass created for this Stock Entry
- Event Handlers: Stock Entry
on_submit,on_cancel, andon_trashevents are hooked - Background Jobs: Gate Pass creation runs in background queue to avoid blocking Stock Entry submission
- Database Locking: Uses
SELECT FOR UPDATEto prevent over-allocation in concurrent scenarios - Reference Management: Automatic cleanup of references when Stock Entries or Gate Passes are cancelled/deleted
For detailed installation and uninstallation instructions, see INSTALLATION.md.
This module follows Semantic Versioning and is compatible with ERPNext v15.x.
Current Version: 1.0.0
For release information and version history, see CHANGELOG.md.
To create a new release, follow the process outlined in RELEASE.md or use the quick reference guide in scripts/QUICK_RELEASE.md.
Quick release command:
./scripts/release.sh <version>
# Example: ./scripts/release.sh 1.0.0This app uses pre-commit for code formatting and linting. Please install pre-commit and enable it for this repository:
cd apps/gate_entry
pre-commit installPre-commit is configured to use the following tools for checking and formatting your code:
- ruff
- eslint
- prettier
- pyupgrade
This app can use GitHub Actions for CI. The following workflows are configured:
- CI: Installs this app and runs unit tests on every push to
developbranch. - Linters: Runs Frappe Semgrep Rules and pip-audit on every pull request.
mit