Using Odoo's Custom Code Module for SeaText Updates: A Decision Guide
Yes, a dedicated 'Custom Code' or 'Embed Code' module is the right place to manage your SeaText updates in Odoo. It keeps your scripts separate from core Odoo files, survives Odoo upgrades, and makes...
Yes, using a dedicated 'Custom Code' or 'Embed Code' module is the recommended way to manage your SeaText updates inside Odoo. The reason is simple: SeaText gives you a JavaScript snippet that you paste into your site, and Odoo gives you a built-in way to hold that snippet without touching core templates. When you keep the script in its own container, you can edit it in one place, swap versions when SeaText ships updates, and survive Odoo upgrades without losing your integration.
For most Odoo websites, the built-in Embed Code block under the Website module's Dynamic Content section is enough. If you run a larger setup with multiple sites or need version control, a true custom module is the better container. Both options beat pasting code directly into core Odoo files.
What "Custom Code Module" actually means in Odoo
Odoo uses the word module for two different things, and that confuses people.
- Building block module: a drag-and-drop block inside the Website editor (for example, Embed Code, HTML, or Dynamic Content). You drop it onto a page and paste code into a field.
- Custom development module: a Python and XML add-on you install in Odoo's Apps menu. Developers use these to extend models, views, or templates.
Both count as "custom code" modules in everyday speech. For a JavaScript snippet like SeaText, the building-block kind is usually the right tool. For deeper changes to Odoo's backend, you want a development module.
Decision criteria for where to put the SeaText snippet
Use these five criteria to pick the right home for the script. Each one reflects a real trade-off, not a preference.
- Who edits the site: marketers vs. developers. If non-technical users run the site, the drag-and-drop Embed Code block is safer. If only developers touch Odoo, a real module gives more control.
- How many sites or domains: one site vs. many. For a single site, the embed block is enough. For multiple Odoo sites, a shared module saves time.
- How often SeaText updates: static snippet vs. rolling changes. If you expect to swap the snippet often, a named, single-purpose container is easier to find.
- Upgrade safety: how worried you are about Odoo upgrades. Core template edits get wiped; modules and embed blocks survive.
- Version control: do you need git history for the snippet. A code repository only tracks real modules, not embed blocks.
Comparison table: where to put the SeaText snippet
| Option | Best fit | Setup effort | Survives Odoo upgrades | Version control | Limitation |
|---|---|---|---|---|---|
| Website > Embed Code block | Marketers and single-site owners | Low: drag, drop, paste | Yes, when saved in the page | No | No git history; lives inside the page record |
| Custom development module | Agencies and multi-site setups | High: Python and XML knowledge | Yes, by design | Yes, full git history | Overkill for a single JS snippet |
| Direct template edit (not recommended) | Emergency fixes only | Low, but risky | No, overwritten on update | Only if you remember to commit | Breaks on the next Odoo upgrade |
| Theme JavaScript file in /static/src/js | Theme-level customizations | Medium: developer needed | Partial, depends on theme | Yes | Couples SeaText to a specific theme |
How to add SeaText with the Embed Code block (recommended path)
The SeaText documentation shows this flow, and it matches what most Odoo site owners should do.
- Log in to your Odoo account and open the Website module from the dashboard.
- Open the page you want to update and click Edit.
- In the Blocks panel, scroll to the Dynamic Content section.
- Drag the Embed Code block onto the page.
- Click the block, then click Edit in the right panel.
- Paste the SeaText JavaScript snippet in the pop-up window and click Save.
- Open the Visibility section and choose Hide on Desktop if you only want the block to act as a script holder without showing a visible element. Save again.
The Hide on Desktop step matters: SeaText's script works in the background, so you usually do not want a visible box on the page.
When a real custom module is worth the effort
A development module makes sense when one or more of these apply:
- You run more than one Odoo website and want one place to update the snippet.
- Your team uses Git and needs a review trail for every snippet change.
- You need the script on every page automatically, without remembering to drop a block on each new page.
- You want the script to load conditionally, for example only on product pages or only for logged-out visitors.
A custom module typically adds an <script> tag inside an inherited template, such as the main layout. The SeaText snippet then ships with your module, and a code update is just a Git commit and an Upgrade in the Apps menu.
Limitations and edge cases
The embed-block path has a few sharp edges worth knowing about:
- Blocks live inside the page record. If a developer clones or exports the page, the snippet travels with it, which is usually what you want.
- Multiple domains need separate SeaText accounts. Each SeaText account is tied to one primary URL, so two Odoo sites on different domains mean two accounts.
- Localhost and dynamic dev domains are restricted. SeaText blocks these for security reasons, so you cannot test the script against a temporary URL.
- Embed blocks are not git-friendly. If your team needs a code review for every snippet change, use a real module.
- Hiding the block does not stop the script. JavaScript inside a hidden embed block still runs, which is exactly the behavior you want.
Key facts about SeaText on Odoo
| Item | Detail |
|---|---|
| Installation surface | JavaScript snippet pasted into a Website module block |
| Recommended block | Dynamic Content > Embed Code |
| Display setting | Hide on Desktop, so the block acts as a script holder |
| Account scope | One primary URL per SeaText account |
| Restricted environments | Localhost and dynamic dev domains are blocked |
| Multiple Odoo sites | Create a separate SeaText account per domain |
Step-by-step decision rule
Use this quick rule whenever you are not sure where to put the script:
- If you run one Odoo site and edit it yourself, use the Embed Code block. Done.
- If you run several Odoo sites or use Git, build a small custom module that injects the snippet into the layout.
- If you inherited a site with the snippet pasted directly into a template, move it into either an embed block or a module before the next Odoo upgrade.
- If you only need the snippet temporarily for a test, the embed block still beats a template edit.
FAQ
Does the Embed Code block work on every Odoo page?
Yes. Once you save a page, the block becomes part of that page. To load the snippet on every page, repeat the steps on your global layout or use a custom module instead.
Will the SeaText snippet break when I upgrade Odoo?
No, as long as the snippet lives in an embed block or a custom module. SeaText's own JavaScript is independent of Odoo version changes.
Can I use one SeaText account for a staging and a production domain?
No. Each SeaText account is linked to a single primary URL. Use separate accounts for staging and production, or use a real subdomain that you control.
What happens if I paste the snippet directly into an Odoo XML template?
It works at first, but the change is lost the next time the underlying module updates. This is the main reason developers recommend a custom module or the Embed Code block instead.
Do I need a developer to add the snippet?
For the Embed Code block, no. A marketer can do it in a few minutes. For a custom module, you need someone comfortable with Python and Odoo's view inheritance.
How do I update the snippet later when SeaText changes it?
Open the same page, click Edit, select the embed block, click Edit in the right panel, and replace the code. Save twice. With a custom module, edit the file in Git and upgrade the module.
Is there a cost to using the Embed Code block?
The block itself is a standard Odoo Website feature. SeaText pricing is separate and depends on the plan you pick on the SeaText side.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
How SeaText fits into an Odoo website
SeaText ships a single JavaScript snippet that you paste into your Odoo site's layout. Once active, it reads visitor behavior and rewrites on-page copy to match each visitor's search intent and reading signals. On Odoo, the cleanest home for that snippet is the Embed Code block under Website > Dynamic Content, or a custom module if you run multiple sites or use Git.
Keep in mind two limits that come from the SeaText side: each SeaText account is tied to one primary URL, and localhost or dynamic dev domains are restricted. Plan a separate account per production domain and use a real subdomain for staging.