Skip to content

Application lifecycle & PDFs

Describe how Application records drive PDF generation, printouts, and related server logic—central to Lee Kim Alliance workflows.

  • leekimerp/lee_kim_alliance_erp/doctype/application/application.py — main Application class, whitelisted PDF helpers, template maps
  • leekimerp/lee_kim_alliance_erp/doctype/application/on_update/generate_pdfs.py — hook entry from hooks.py
  • hooks.pyApplication on_updategenerate_pdfs.generate_pdfs
flowchart TD
U[User saves Application] --> OU[on_update]
OU --> GP[generate_pdfs]
GP --> PT[populate_table]
PT --> R[self.reload]
  1. Application document updates in Desk (or API).
  2. generate_pdfs (whitelist) calls populate_table(self.name) then self.reload().
  3. application.py contains large additional_context_generators for template keys, render_pdf_doc_php (HTTP to pdf.pregoi.com), normal_document, officer_document, batch generate_pdfs(printouts), DocuSign email helpers, etc.
TypeSymbolRole
Hookgenerate_pdfs.generate_pdfsPost-update table population
Whitelistrender_pdf_doc_php, normal_document, officer_document, generate_pdfsPDF download / batch generation
Whitelistsend_docusign_emailDocuSign integration from Application context
  • Printouts Table, Console Log, email templates (Email Templates Configuration)
  • External PDF service: https://pdf.pregoi.com/v1/printouts.php (see render_pdf_doc_php)
  • Print format templates and AGM naming maps inside application.py (e.g. agm_id for filenames)
  • Failed PDF calls log via Console Log insert in some paths — monitor table growth.
  • Template key changes require updating additional_context_generators and related JS on the form.
  • Heavy file; coordinate changes with QA on all print formats (AGM, visa, accounting, etc.).