diff --git a/PROJECT_STATE.md b/PROJECT_STATE.md index 1b05bce..1d74abb 100644 --- a/PROJECT_STATE.md +++ b/PROJECT_STATE.md @@ -1,3 +1,17 @@ +## v3.0.2 edit invoice Save and Send - 2026-06-01 UTC + +- Added a second button on the admin Edit Invoice page: “Save and Send”. +- “Save Invoice” keeps the existing save-only behavior. +- “Save and Send” saves the invoice first, then reuses the existing invoice email workflow. +- The email workflow continues to generate and attach the invoice PDF. +- Successful sends redirect back to the invoice view with `email_sent=1`. +- Failed sends redirect back to the invoice view with `email_failed=1`. +- Works with the v3.0.1 multi-line invoice edit workflow. + +Verified: +- Save Invoice still saves without sending. +- Save and Send saves the invoice and sends the client invoice email. + ## v3.0.1 multi-line invoice edit safety - 2026-06-01 UTC - Updated admin invoice edit workflow to preserve multi-line invoice items. diff --git a/README.md b/README.md index e716f9f..6e84a9d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +## v3.0.2 edit invoice Save and Send - 2026-06-01 UTC + +- Added a second button on the admin Edit Invoice page: “Save and Send”. +- “Save Invoice” keeps the existing save-only behavior. +- “Save and Send” saves the invoice first, then reuses the existing invoice email workflow. +- The email workflow continues to generate and attach the invoice PDF. +- Successful sends redirect back to the invoice view with `email_sent=1`. +- Failed sends redirect back to the invoice view with `email_failed=1`. +- Works with the v3.0.1 multi-line invoice edit workflow. + +Verified: +- Save Invoice still saves without sending. +- Save and Send saves the invoice and sends the client invoice email. + ## v3.0.1 multi-line invoice edit safety - 2026-06-01 UTC - Updated admin invoice edit workflow to preserve multi-line invoice items. diff --git a/VERSION b/VERSION index b105cea..96506fd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.1 +v3.0.2 diff --git a/backend/app.py b/backend/app.py index f262df5..9a13ab5 100644 --- a/backend/app.py +++ b/backend/app.py @@ -4553,6 +4553,7 @@ def edit_invoice(invoice_id): ) if request.method == "POST": + submit_action = request.form.get("submit_action", "save").strip() due_at = request.form.get("due_at", "").strip() notes = request.form.get("notes", "").strip() @@ -4570,6 +4571,8 @@ def edit_invoice(invoice_id): )) conn.commit() conn.close() + if submit_action == "save_send": + return email_invoice(invoice_id) return redirect(f"/invoices/view/{invoice_id}") client_id = request.form.get("client_id", "").strip() @@ -4746,6 +4749,8 @@ def edit_invoice(invoice_id): conn.commit() conn.close() + if submit_action == "save_send": + return email_invoice(invoice_id) return redirect(f"/invoices/view/{invoice_id}") rendered = _render([]) diff --git a/templates/invoices/edit.html b/templates/invoices/edit.html index 62f33bf..305490b 100644 --- a/templates/invoices/edit.html +++ b/templates/invoices/edit.html @@ -207,7 +207,8 @@ Notes

- + +