142 lines
5.5 KiB
Python
142 lines
5.5 KiB
Python
from . import __version__ as app_version
|
|
|
|
app_name = "agri_seedling"
|
|
app_title = "Agri Seedling"
|
|
app_publisher = "Agri Seedling Operations Team"
|
|
app_description = "Farm Management System — field activities, resource tracking, dispatch and reporting"
|
|
app_email = "sysadmin@agriseedling.com"
|
|
app_license = "Proprietary"
|
|
|
|
# Apps
|
|
# ------------------
|
|
# required_apps = ["erpnext"]
|
|
|
|
# Includes in <head>
|
|
# ------------------
|
|
# app_include_css = "/assets/agri_seedling/css/agri_seedling.css"
|
|
# app_include_js = "/assets/agri_seedling/js/agri_seedling.js"
|
|
|
|
# Home Pages
|
|
# ----------
|
|
# role_home_page = {"Field Worker": "agri-seedling-mobile"}
|
|
|
|
# Fixtures — exported with `bench export-fixtures`, keeps Roles/Custom Fields
|
|
# in version control across environments
|
|
# ---------------------------------------------------------------------------
|
|
fixtures = [
|
|
{"dt": "Role", "filters": [["role_name", "in", [
|
|
"Admin",
|
|
"Stock Manager",
|
|
"Inventory Manager",
|
|
"Accountant",
|
|
"Field Worker",
|
|
]]]},
|
|
"Notification",
|
|
{"dt": "Print Format", "filters": [["module", "=", "Agri Seedling"]]},
|
|
]
|
|
|
|
# Document Events
|
|
# ---------------
|
|
# Hook on document methods and events. Mirrors Chapter 4/6/9 of the manual:
|
|
# stock deduction, notifications, and immutability of submitted spray logs.
|
|
doc_events = {
|
|
"Scouting Report": {
|
|
"on_submit": "agri_seedling.agri_seedling.utils.notifications.notify_scouting_alert",
|
|
},
|
|
"Spray Log Morning": {
|
|
"validate": "agri_seedling.agri_seedling.utils.compliance.enforce_ppe_checklist",
|
|
"on_submit": [
|
|
"agri_seedling.agri_seedling.utils.stock.deduct_spray_resources",
|
|
"agri_seedling.agri_seedling.utils.compliance.start_reentry_interval_lock",
|
|
],
|
|
"on_cancel": "agri_seedling.agri_seedling.utils.stock.reverse_spray_resources",
|
|
},
|
|
"Spray Log Evening": {
|
|
"validate": "agri_seedling.agri_seedling.utils.compliance.enforce_ppe_checklist",
|
|
"on_submit": [
|
|
"agri_seedling.agri_seedling.utils.stock.deduct_spray_resources",
|
|
"agri_seedling.agri_seedling.utils.compliance.start_reentry_interval_lock",
|
|
],
|
|
"on_cancel": "agri_seedling.agri_seedling.utils.stock.reverse_spray_resources",
|
|
},
|
|
"Planting Record": {
|
|
"on_submit": [
|
|
"agri_seedling.agri_seedling.utils.stock.deduct_seed_stock",
|
|
"agri_seedling.agri_seedling.utils.tray_registry.create_tray_entries",
|
|
],
|
|
},
|
|
"Dispatch Record": {
|
|
"on_submit": [
|
|
"agri_seedling.agri_seedling.utils.stock.deduct_dispatch_resources",
|
|
"agri_seedling.agri_seedling.utils.notifications.notify_dispatch_complete",
|
|
],
|
|
},
|
|
"Order Patch": {
|
|
"on_submit": "agri_seedling.agri_seedling.utils.notifications.notify_order_patched",
|
|
},
|
|
"Tray Recycling Record": {
|
|
"on_submit": "agri_seedling.agri_seedling.utils.tray_registry.return_trays_to_stock",
|
|
},
|
|
"Resource Inventory": {
|
|
"on_update": "agri_seedling.agri_seedling.utils.stock.check_low_stock_threshold",
|
|
},
|
|
}
|
|
|
|
# Scheduled Tasks
|
|
# ---------------
|
|
# Maps to Chapter 6 (notification triggers) and Chapter 5 (reorder alerts)
|
|
scheduler_events = {
|
|
"cron": {
|
|
# Daily 18:00 — resource consumption report to Stock Manager + Admin
|
|
"0 18 * * *": [
|
|
"agri_seedling.agri_seedling.report.daily_resource_consumption.daily_resource_consumption.send_daily_report"
|
|
],
|
|
# Every 15 min — release zones whose Re-Entry Interval has expired
|
|
"*/15 * * * *": [
|
|
"agri_seedling.agri_seedling.utils.compliance.release_expired_reentry_locks"
|
|
],
|
|
},
|
|
"daily": [
|
|
"agri_seedling.agri_seedling.utils.stock.run_low_stock_scan",
|
|
"agri_seedling.agri_seedling.utils.jigs.check_jig_maintenance_due",
|
|
"agri_seedling.agri_seedling.utils.sync.warn_stale_offline_records",
|
|
],
|
|
"hourly": [
|
|
"agri_seedling.agri_seedling.utils.tasks.send_due_activity_reminders",
|
|
],
|
|
}
|
|
|
|
# Permission Query Conditions
|
|
# ---------------------------
|
|
# Row-level isolation for Field Workers (Sec 9.2): can only read own submissions.
|
|
permission_query_conditions = {
|
|
"Scouting Report": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Spray Log Morning": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Spray Log Evening": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Planting Record": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Soaking Record": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Greenhouse Watering Log": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Seedling Watering Log": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Cover Log": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
"Tray Recycling Record": "agri_seedling.agri_seedling.utils.permissions.field_worker_match_condition",
|
|
}
|
|
|
|
has_permission = {
|
|
"Scouting Report": "agri_seedling.agri_seedling.utils.permissions.field_worker_has_permission",
|
|
}
|
|
|
|
# Authentication / Session
|
|
# ------------------------
|
|
# Field Worker (Guest User) sessions expire at midnight — see Sec 9.1
|
|
# Implemented via a login hook that sets a short-lived session for the
|
|
# "Field Worker" role; see agri_seedling/utils/auth.py
|
|
on_session_creation = "agri_seedling.agri_seedling.utils.auth.set_field_worker_session_expiry"
|
|
|
|
# Website Route Rules (kept minimal — mobile app is the field-worker client)
|
|
# ---------------------------------------------------------------------------
|
|
website_route_rules = []
|
|
|
|
# override_whitelisted_methods = {
|
|
# "agri_seedling.api.mobile_sync.push_activity": "agri_seedling.agri_seedling.api.mobile_sync.push_activity",
|
|
# }
|