Skip to content

Billing flow

Explain what happens when a Billing document is created and how payment success triggers customer emails.

  • leekimerp/hooks.py"Billing": {"after_insert": "leekimerp.tasks.handle_billing"}
  • leekimerp/tasks.pyhandle_billing, send_payment_success_email, send_company_related_emails
sequenceDiagram
participant B as Billing after_insert
participant H as handle_billing
participant S as send_payment_success_email
participant M as send_template_mail
B->>H: doc, method
H->>S: doc_dict
alt status Paid + Incorporation
S->>M: Incorporate Success template
else status Paid + Additional Services
S->>M: Additional Service Payment Success template
end
  • handle_billing runs only for after_insert, converts the document to dict, and calls send_payment_success_email.
  • send_payment_success_email loads Application via payment_for, loads User, and picks Email Templates Configuration by service_type (Incorporation vs Additional Services) when status == "Paid".
  • Desk: Creating/submitting Billing per your workflow
  • Hook: No direct HTTP API required for this path
  • Email Templates Configuration DocTypes named above must exist and be valid.
  • If emails do not send, verify Billing field values (status, service_type, payment_for) and template documents.