AGM & scheduler
Purpose
Section titled “Purpose”Document AGM-related automation: scheduled job entry points and known issues with on_update handlers tied to auto-email.
Scope in codebase
Section titled “Scope in codebase”leekimerp/scheduler_events/agm_legacy.py—agm_conditional_legacyand related ACRA data logicleekimerp/lee_kim_alliance_erp/doctype/agm/— AGM DocType controllershooks.py— commented"AGM": {"on_update": "leekimerp.tasks.after_agm_update_generate_auto_email"}
Scheduler
Section titled “Scheduler”| Cron | Handler |
|---|---|
0 7 * * * | leekimerp.scheduler_events.agm_legacy.agm_conditional_legacy |
Flow (conceptual)
Section titled “Flow (conceptual)”flowchart LR CRON[Daily 07:00] --> AGM[agm_conditional_legacy] AGM --> ACRA[ACRA API / token helpers] AGM --> DOCS[AGM DocType updates]agm_legacy.py imports get_simple_acra_api_token, make_simple_acra_request_return_data, and analyze_table_fields from lee_kim_alliance_erp.doctype.agm.agm.
Known issues (from hooks.py comments)
Section titled “Known issues (from hooks.py comments)”after_agm_update_generate_auto_emailis disabled on AGMon_updatebecause it was observed to break the cron job (agm_conditional_cron): the job could halt or get stuck.- Same problem was reported when moving that logic to
agm.pyon_update. - Do not re-enable without fixing root cause and load-testing the scheduler.
Entry points
Section titled “Entry points”- Cron: Frappe scheduler worker must be running.
- Desk: Manual AGM documents as per business process.
Dependencies
Section titled “Dependencies”- ACRA settings and API tokens (see
agm.pyand related DocTypes)
Operational notes
Section titled “Operational notes”- Monitor scheduler logs after any change to AGM hooks or
tasksrelated to auto-email.