TIP: You can type at any time to perform a new search.
Text from HTML field
html_text · OCA/server-tools
- Repository
- OCA/server-tools · module folder · Try on Runboat
- Module version
- 1.0.0
- Category
- Tools
- Folder size
- 0.04 MB
- License
- AGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://github.com/OCA/server-tools
- Last tracking update
- 2026-08-07 08:42:58
- Authors
- Odoo Community Association (OCA), Onestein, Tecnativa, Grupo ESOC Ingeniería de Servicios
- Maintainers
- Odoo Community Association (OCA), Onestein, Tecnativa, Grupo ESOC Ingeniería de Servicios
- Committers
- Weblate, OCA-git-bot, oca-ci, chaule97
- Odoo dependencies
-
odoo/odoo:- base
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
- Description
This module provides some technical features that allow to extract text from any chunk of HTML, without HTML tags or attributes. You can chose either: - To truncate the result by amount of words or characters. - To append an ellipsis (or any character(s)) at the end of the result. It can be used to easily generate excerpts.
Code Analysis ⓘ
Views touched (0)
No views found for this module.
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (1)
New fields (0)
No new fields.
Public methods (1)-
text_from_html(self, html_content, max_words=None, max_chars=None, ellipsis='…', fail=False)@api.modelExtract text from an HTML field in a generator. :param str html_content: HTML contents from where to extract the text. :param int max_words: Maximum amount of words allowed in the resulting string. :param int max_chars: Maximum amount of characters allowed in the resulting string. If you apply this limit, beware that the last word could get cut in an unexpected place. :param str ellipsis: Character(s) to be appended to the end of the resulting string if it gets truncated after applying limits set in :param:`max_words` or :param:`max_chars`. If you want nothing applied, just set an empty string. :param bool fail: If ``True``, exceptions will be raised. Otherwise, an empty string will be returned on failure.
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
- Status
- Open migration PR — not merged yet for this version
- CI status
- green — ready to merge
- Open since
- 69 days ago
- Last activity
- 52 days ago
- Repository
- OCA/server-tools
- Pull request
- [19.0][MIG] html_text: Migration to 19.0 (#3653)