Application lifecycle & PDFs
Purpose
Section titled “Purpose”Describe how Application records drive PDF generation, printouts, and related server logic—central to Lee Kim Alliance workflows.
Scope in codebase
Section titled “Scope in codebase”leekimerp/lee_kim_alliance_erp/doctype/application/application.py— mainApplicationclass, whitelisted PDF helpers, template mapsleekimerp/lee_kim_alliance_erp/doctype/application/on_update/generate_pdfs.py— hook entry fromhooks.pyhooks.py—Applicationon_update→generate_pdfs.generate_pdfs
flowchart TD U[User saves Application] --> OU[on_update] OU --> GP[generate_pdfs] GP --> PT[populate_table] PT --> R[self.reload]- Application document updates in Desk (or API).
generate_pdfs(whitelist) callspopulate_table(self.name)thenself.reload().- application.py contains large
additional_context_generatorsfor template keys,render_pdf_doc_php(HTTP topdf.pregoi.com),normal_document,officer_document, batchgenerate_pdfs(printouts), DocuSign email helpers, etc.
Entry points
Section titled “Entry points”| Type | Symbol | Role |
|---|---|---|
| Hook | generate_pdfs.generate_pdfs | Post-update table population |
| Whitelist | render_pdf_doc_php, normal_document, officer_document, generate_pdfs | PDF download / batch generation |
| Whitelist | send_docusign_email | DocuSign integration from Application context |
Dependencies
Section titled “Dependencies”- Printouts Table, Console Log, email templates (
Email Templates Configuration) - External PDF service:
https://pdf.pregoi.com/v1/printouts.php(seerender_pdf_doc_php)
Configuration
Section titled “Configuration”- Print format templates and AGM naming maps inside
application.py(e.g.agm_idfor filenames)
Operational notes
Section titled “Operational notes”- Failed PDF calls log via
Console Loginsert in some paths — monitor table growth. - Template key changes require updating
additional_context_generatorsand related JS on the form.
Known gaps
Section titled “Known gaps”- Heavy file; coordinate changes with QA on all print formats (AGM, visa, accounting, etc.).