# SRS → Odoo 19 Implementation Deviations

The SRS (`SRS_do_mail_quick_templates_odoo19.md`) was written against pre-v19 APIs
in several places. Every requirement is implemented; the items below were
adapted to the **verified Odoo 19 source** (`/Users/prashantgosai/workspace/19.0
- community`). Source citations are inline in the code.

| SRS reference | SRS text | Odoo 19 reality | What was implemented |
|---|---|---|---|
| §2.3 / §6.3 / §16.1 | Patch `ChatterComposer` from `@mail/components/chatter_composer/chatter_composer` + inject a raw `<button>` | That component/path does not exist. The composer is `Composer` (`@mail/core/common/composer`); toolbar buttons come from the registry `mail.composer/actions` (`composer_actions.js`) | Registered a composer action with `registerComposerAction()` (`static/src/js/composer_action.js`). Identical UX (icon button → popover). |
| §6.3 / §23.4 | `useService('rpc')` | v19 uses `import { rpc } from "@web/core/network/rpc"` | Used the `rpc` import. |
| §6.3 | Overlay service for the popover | v19 hook is `usePopover` (`@web/core/popover/popover_hook`) | Used `usePopover`. |
| §2.3 | Insert resolved HTML "into the compose box" | v19: assigning `composer.composerHtml = markup(html)` triggers the reactive effect that updates the live editor | Set `composerHtml`; empty-check via `isHtmlEmpty` (`@web/core/utils/html`). |
| §5.1 | `res.groups` with `category_id` ref `base.module_category_discuss` | v19 removed `res.groups.category_id` (now `privilege_id` → `res.groups.privilege`); `base.module_category_discuss` does not exist | Created a `res.groups.privilege` under `base.module_category_productivity` and set `privilege_id`. |
| §4.2 etc. | `_sql_constraints = [...]` and `_indexes = [...]` | v19 **no longer supports** the `_sql_constraints` list (logs a warning, ignored). Constraints/indexes are `models.Constraint` / `models.Index` table objects | Migrated all unique constraints to `models.Constraint` and composite indexes to `models.Index`. Python `@api.constrains` still backs cross-PG-version name uniqueness. |
| §2.9 / §6.3 | Feature flag checked client-side before rendering the button | The composer action `condition` is synchronous — no place to await an RPC | Surfaced `enabled AND user-in-group` via `ir.http.session_info()` → `session.do_mail_quick_templates_enabled` (no flicker). |
| §6.5 | Settings xpath anchor `//div[@id='mail_general_configuration']` | v19 settings use `<block id="discuss">` inside `mail.res_config_settings_view_form` | Inherited `mail.res_config_settings_view_form`, added a `<setting>` inside the `discuss` block. |
| §2.8 / §4.2 | `mail.message.attachment.max.filesize` | v19 system param is `base.default_max_email_size` | No module-level size cap (per SRS); Odoo's system limit applies. |
| §11 | Report `t-call="web.html_container"` only | v19 standard is `web.external_layout` wrapped by `web.html_container` | Report uses both (`html_container` → `external_layout`). |
| §6.2 / §13.3 | `<tree>` list views | v19 uses `<list>` | All list views use `<list>`. |
| §12 | KPI stat-cards + bar chart as a `ControlPanelAdditional` OWL component injected into the list view | High-fragility, low-value, Enterprise-leaning. SRS itself allows "Community: show table instead" | Delivered the analytics as Community-compatible `graph` + `pivot` views on the usage log (`Usage Analytics` menu, 30/90-day filters), plus the PDF report and XLSX export. Functionally equivalent (top templates, usage by period). |
| §9.7 (BR-16) | Non-blocking popup warning when archiving a category that still has active templates | A truly non-blocking warning on `write` is not feasible server-side | Picker groups orphaned templates under "Other" (controller). The blocking delete guard (BR-12) is enforced. |
| §23.2 | License `OPL-1` | OPL-1 is proprietary and conflicts with "must run on Community" + the LGPL `mail` dependency | Set `LGPL-3` (appropriate for a module extending LGPL core). Change in `__manifest__.py` if a commercial license is required. |

## Areas to validate during live install/UAT

1. **Attachment auto-add** (`_attachDefaults` in `template_picker.js`): copies the
   template's attachments server-side and inserts them into `composer.attachments`
   via the mail store. This is wrapped in try/except and never blocks the insert;
   confirm the attachments appear on the posted message in your environment.
2. Run `odoo-bin -d <db> -i do_mail_quick_templates --test-enable --stop-after-init`
   and confirm a clean log (zero errors/warnings) and all tests green.
