Cobra · Odoo email + conditional routing
PO email routing: Drop vs Restock + Cobra templates
Context
Purchase order confirmation emails were using the generic Odoo template. No distinction between Drop (direct customer delivery) and Restock (warehouse delivery) — yet the supplier message is fundamentally different in each case.
What was built
- Redirect of
purchase.email_template_edi_purchaseto the Cobra template (12) via XML-RPC - Template 12 Restock (FR+EN): "Cobra warehouse delivery" badge, Points to confirm block, proforma
- Template 80 Drop (FR+EN): "Direct delivery" badge, customer address block, tracking
- Override
_send_confirmation_mail()(v1.4.2): ifx_order_type == 'drop'→ template 80, otherwisesuper()→ 12 - Cherry-pick onto main → in production
What was tricky
- The
mail_notification_lightlayout overridesbackground-coloron<td>elements — colored backgrounds disappear. Fix: wrap the background in a nested<div> - The Odoo preview doesn't reflect the actual render (Apple Mail) — testing by sending for real is necessary
Stack
Python XML-RPC, cobra_purchase Odoo 18, mail.template, ir.model.data, HTML email (nested tables, inline CSS), Git (targeted cherry-pick).
What this illustrates
End-to-end session: Claude drives Odoo via API, iterative debugging on undocumented email rendering, production delivery with a targeted cherry-pick. Autonomous across a problem that mixes Odoo config, HTML email, and Git deployment.