Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Technical
  3. Collapsible HTML Field v 18.0
  4. Sales Conditions FAQ

Collapsible HTML Field

by ERP23 https://erp-23.com
Odoo
v 18.0 Third Party 4
Download for v 18.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 66
Technical Name web_collapsible_html_field
LicenseLGPL-3
Websitehttps://erp-23.com
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 66
Technical Name web_collapsible_html_field
LicenseLGPL-3
Websitehttps://erp-23.com
Odoo 18 · Pure OWL/JS · Zero Config

Collapsible HTML Field

Automatically collapse long rich-text descriptions in Odoo 18 backend forms. A smooth Show more / Show less toggle appears only when content overflows — and the Wysiwyg editor stays fully functional in edit mode.

LGPL-3 Depends: web, html_editor No Python · No DB Migration Drop-in Widget by ERP23 · erp-23.com
👁 Smart Collapse Clips content to 120 px with a CSS fade. The toggle appears only when the content actually overflows — short fields are left untouched.
✍ Edit Mode Unaffected Height restriction is applied only in readonly mode. The Wysiwyg editor is never clipped — users type and format freely.
⚡ Zero Footprint Pure OWL/JS. No Python models, no database tables, no settings menus. One attribute change: widget="collapsible_html".

Overview

Odoo's standard html field renders the full content regardless of length, pushing everything else off-screen on records with verbose rich-text descriptions. Collapsible HTML Field wraps the standard widget with collapse-and-expand behaviour using a pure OWL 2 component. It also fixes the sandboxed preview bug where Word-pasted HTML (containing a <head> tag) forces the field into an uneditable readonly preview even in edit/draft mode.

See It in Action

Collapsed state — partial text with fade and Show more button

▼ Collapsed state — content clipped to 120 px with a bottom fade. “Show more” button appears only when content overflows.

Expanded state — full content visible with Show less button

▲ Expanded state — one click reveals the full content. “Show less” collapses it back.

Edit mode — Wysiwyg toolbar active, field fully editable

✎ Edit mode — Wysiwyg toolbar loads normally. No height restriction is ever applied in edit state.

Key Features

Collapse

Smart Overflow Detection

On every render the component measures true scrollHeight and shows the toggle only when content exceeds 120 px.

Editor

Wysiwyg Always Works

Height restriction is applied only in readonly mode. The rich-text editor is never wrapped or constrained in edit state.

Bug Fix

sandboxedPreview Override

Word-pasted HTML (with <head> tags) no longer forces the field into an uneditable sandboxed preview during edit mode.

UX

Auto-Reset on Navigation

When the user navigates to a different record, the field resets to collapsed automatically. No stale “Show less” state left behind.

Styling

Theme-Safe Fade

Uses CSS mask-image for the bottom fade — works correctly on dark and coloured themes without a white overlay.

Integration

Drop-in on Any Model

Works on any fields.Html field in any model. No Python changes — just swap the widget attribute in the form view XML.

✓ What is Covered

  • Any fields.Html field on any Odoo model
  • Readonly mode: collapse + Show more / Show less toggle
  • Edit mode: full Wysiwyg editor, no height limit
  • Word-pasted HTML with complex <head> tags
  • Record navigation: auto-reset to collapsed
  • Odoo 18.0 Community & Enterprise

⊗ What is NOT Affected

  • Short fields that don’t overflow 120 px (no toggle shown)
  • List / Kanban / other non-form views
  • Website / portal views
  • Odoo 17.0 and below (different html_editor API)
  • Non-Html field types (Char, Text, etc.)

Developer Guide

1. Basic Usage

Replace widget="html" with widget="collapsible_html" on any html field in a form view:

<!-- Before -->
<field name="description" widget="html"/>

<!-- After -->
<field name="description" widget="collapsible_html"/>

2. Add as a Dependency

In your module’s __manifest__.py, declare the dependency so the widget JS is loaded before your views:

{
    'name': 'My Module',
    'depends': [
        'web',
        'web_collapsible_html_field',  # <-- add this
    ],
}

3. Override a Core View with Inheritance

Use position="attributes" to change only the widget attribute without touching any other part of the view:

<record id="project_task_form_collapsible_desc" model="ir.ui.view">
    <field name="name">project.task.form.collapsible.desc</field>
    <field name="model">project.task</field>
    <field name="inherit_id" ref="project.view_task_form2"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='description']"
               position="attributes">
            <attribute name="widget">collapsible_html</attribute>
        </xpath>
    </field>
</record>

4. Customise Collapse Height via CSS

The default height is 120 px. Override it with a SCSS/CSS rule in your own module:

/* Collapse to 200 px instead */
.bs-collapsible-html-wrapper.bs-collapsed {
    max-height: 200px;
}
Note: If you also want the overflow threshold to change (the point at which the toggle button appears), fork the JS and update the COLLAPSED_HEIGHT_PX constant at the top of collapsible_html_field.js.

Installation

  1. Download the module from the Odoo App Store.
  2. Place the web_collapsible_html_field folder in your Odoo addons directory.
  3. Restart the Odoo server.
  4. Go to Settings → Apps, search for Collapsible HTML Field, and click Install.
  5. Add widget="collapsible_html" to any html field in your form views.
No database migration required. The module is pure JavaScript/OWL — it adds no new models or columns. Safe to install on any Odoo 18 database without downtime.

Technical Details

📄
Pure OWL 2 / JS Extends HtmlField from @html_editor — no Python, no XML models
🛡
Odoo 18 Ready Built for Odoo 18.0 CE & EE. Uses OWL 2 primary template inheritance from html_editor.HtmlField
⚖
LGPL-3 License Open source — free to use, modify, and distribute under the LGPL-3 terms
🚀
Zero Performance Impact Collapse is CSS-only at runtime. JS only runs on mount/patch to measure scrollHeight

Support & Contact

We’re here to help — reach out via any channel below.

🌐
Website erp-23.com
📧
Email erp23@brainstation-23.com
🐞
Bug Reports GitHub Issues
🏢
Company BrainStation-23

© 2025 ERP23 — a product of BrainStation-23. Released under LGPL-3. Compatible with Odoo 18.0.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with