PDF invoice reports + SMTP email sending

PDF Reports:
- Professional invoice HTML renderer (company header, partner address,
  styled line items, totals, Odoo-purple branding, A4 @page CSS)
- wkhtmltopdf installed in Docker runtime stage for real PDF generation
- Print button on invoice form (opens PDF in new tab)
- Exported HtmlToPDF/RenderInvoiceHTML for cross-package use

SMTP Email:
- SendEmail + SendEmailWithAttachments with MIME multipart support
- Base64 file attachments
- Config via ODOO_SMTP_HOST/PORT/USER/PASSWORD/FROM env vars
- LoadSMTPConfig helper, nil auth for relay servers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-04-04 13:58:19 +02:00
parent cc6184a18b
commit 2c7c1e6c88
6 changed files with 336 additions and 12 deletions

View File

@@ -949,6 +949,17 @@ func initAccountMove() {
return true, nil
})
// action_invoice_print: opens the invoice PDF in a new tab.
// Mirrors: odoo/addons/account/models/account_move.py action_invoice_print()
m.RegisterMethod("action_invoice_print", func(rs *orm.Recordset, args ...interface{}) (interface{}, error) {
moveID := rs.IDs()[0]
return map[string]interface{}{
"type": "ir.actions.act_url",
"url": fmt.Sprintf("/report/pdf/account.report_invoice/%d", moveID),
"target": "new",
}, nil
})
// -- BeforeCreate Hook: Generate sequence number --
m.BeforeCreate = func(env *orm.Environment, vals orm.Values) error {
name, _ := vals["name"].(string)