Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d926dde
Excerpt generator.
yajo Apr 4, 2016
f41c30e
Do not die miserably when you get `False` as the HTML input. Test it.
yajo Apr 5, 2016
b11308d
html_text * Updated README.rst
cubells Nov 28, 2016
953756e
[MIG][10.0][html_text] Migrate
yajo Jun 22, 2017
c7ba94c
[MIG] html_text: Migration to 11.0
tarteo Feb 14, 2018
c046f74
[FIX] External python override for package `lxml.html` (#1234)
Apr 27, 2018
8397bd4
[UPD] Update html_text.pot
oca-travis Jun 17, 2018
233f9d9
[MIG] html_text:Migration to 12.0
Dike90 Nov 3, 2018
b3cb16b
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
58d8090
Translated using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
bc49d0c
Added translation using Weblate (Croatian)
badbole Nov 13, 2019
2059277
Translated using Weblate (Croatian)
badbole Nov 13, 2019
fc5df9f
[IMP] html_text: black, isort, prettier
victoralmau Feb 19, 2021
0563364
[MIG] html_text: Migration to 13.0
victoralmau Feb 19, 2021
b0d8fbd
[UPD] Update html_text.pot
oca-travis Feb 19, 2021
5974a99
[UPD] README.rst
OCA-git-bot Feb 19, 2021
b74eb9a
Update translation files
oca-transbot Feb 19, 2021
f818f70
Translated using Weblate (Spanish)
anasuarez1 Mar 19, 2021
3b7468d
[MIG] html_text: Migration to 14.0
hkapatel-initos May 24, 2021
105841b
[UPD] Update html_text.pot
oca-travis Jul 23, 2021
010a221
[UPD] README.rst
OCA-git-bot Jul 23, 2021
0cc21a4
Update translation files
oca-transbot Jul 23, 2021
1bc66e8
[MIG] html_text: Migration to 15.0
Jan 13, 2022
ae24376
[UPD] Update html_text.pot
Feb 2, 2022
e2d5b7f
[UPD] README.rst
OCA-git-bot Feb 2, 2022
e1d79d5
[IMP] update dotfiles
OCA-git-bot Mar 30, 2022
1d146ae
Added translation using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
67be437
Translated using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
b7fbe62
[IMP] html_text: pre-commit stuff
dsolanki-initos Mar 22, 2023
a3933e3
[MIG] html_text: Migration to 16.0
dsolanki-initos Mar 22, 2023
28694d7
[UPD] Update html_text.pot
Nov 1, 2023
894471b
[BOT] post-merge updates
OCA-git-bot Nov 1, 2023
2f117f0
Translated using Weblate (Spanish)
Ivorra78 Nov 9, 2023
38bc2cf
Translated using Weblate (Italian)
mymage Jan 3, 2024
43a21e0
[IMP] remove python libs included in odoo requirements
CRogos Apr 4, 2024
f274fe2
[BOT] post-merge updates
OCA-git-bot Apr 9, 2024
f11e786
[IMP] html_text: black, isort, prettier
manuelregidor Feb 21, 2025
7cb42cd
[MIG]html_text: Migration to 17.0
manuelregidor Feb 21, 2025
090d4d6
[UPD] Update html_text.pot
Feb 22, 2025
b608272
[BOT] post-merge updates
OCA-git-bot Feb 22, 2025
4885ce1
Update translation files
weblate Feb 22, 2025
bc4cea0
[IMP] html_text: pre-commit auto fixes
chaule97 Mar 26, 2025
d2b6a04
[MIG] html_text: Migration to 18.0
chaule97 Mar 26, 2025
99bb594
[UPD] Update html_text.pot
Apr 5, 2025
8dc0550
[BOT] post-merge updates
OCA-git-bot Apr 5, 2025
ce0e295
Translated using Weblate (Italian)
mymage Jul 23, 2025
8f6e3ed
[MIG] html_text: Migration to 19.0
hi-oerp Jun 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions html_text/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

====================
Text from HTML field
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6309273dc63ea41c703631efbfd5636c9eabeb563ce385c0c65e5a451fe41de9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/19.0/html_text
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-html_text
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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.

**Table of contents**

.. contents::
:local:

Usage
=====

This module just adds a technical utility, but nothing for the end user.

If you are a developer and need this utility for your module, see these
examples and read the docs inside the code.

Python example:

::

def some_method(self):
# Get truncated text from an HTML field. It will 40 words and 100
# characters at most, and will have "..." appended at the end if it
# gets truncated.
truncated_text = self.env["ir.fields.converter"].text_from_html(
self.html_field, 40, 100, "...")

QWeb example:

::

<t t-esc="env['ir.fields.converter'].text_from_html(doc.html_field)"/>

|Try me on Runbot|

.. |Try me on Runbot| image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:target: https://runbot.odoo-community.org/runbot/149/11.0

Known issues / Roadmap
======================

- An option could be added to try to respect the basic HTML tags inside
the excerpt (``<b>``, ``<i>``, ``<p>``, etc.).

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20html_text%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Grupo ESOC Ingeniería de Servicios
* Tecnativa
* Onestein

Contributors
------------

- Dennis Sluijk <d.sluijk@onestein.nl>

- `Tecnativa <https://www.tecnativa.com>`__:",

- Helly kapatel <helly.kapatel@initos.com>

- Mantas Šniukas <mantas@vialaurea.lt>

- Dhara Solanki <dhara.solanki@initos.com>

- Jairo Llopis
- Vicent Cubells
- Víctor Martínez

- Chau Le <chaulb@trobz.com>

- `OERP Canada <https://www.oerp.ca/>`__:

- Hembert Iregui hi@oerp.ca

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/19.0/html_text>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions html_text/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions html_text/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Text from HTML field",
"summary": "Generate excerpts from any HTML field",
"version": "19.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
"author": "Grupo ESOC Ingeniería de Servicios, "
"Tecnativa, "
"Onestein, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["base"],
}
25 changes: 25 additions & 0 deletions html_text/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n"
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.fields.converter"
25 changes: 25 additions & 0 deletions html_text/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.fields.converter"
37 changes: 37 additions & 0 deletions html_text/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-17 02:07+0000\n"
"PO-Revision-Date: 2023-11-09 20:38+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertidor de Campos"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID (identificación)"

#~ msgid "Last Modified on"
#~ msgstr "Última Modifiación el"

#~ msgid "Smart Search"
#~ msgstr "Búsqueda Inteligente"
22 changes: 22 additions & 0 deletions html_text/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-09-04 06:07+0000\n"
"Last-Translator: Ignacio Buioli <ibuioli@gmail.com>\n"
"Language-Team: none\n"
"Language: es_AR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertidor de Campos"
26 changes: 26 additions & 0 deletions html_text/i18n/es_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Fernando Lara <gennesis45@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-16 10:39+0000\n"
"PO-Revision-Date: 2017-02-16 10:39+0000\n"
"Last-Translator: Fernando Lara <gennesis45@gmail.com>, 2017\n"
"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/"
"es_ES/)\n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.documentos.conversor"
23 changes: 23 additions & 0 deletions html_text/i18n/hr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-11-13 17:34+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 3.8\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Pretvaranje polja"
24 changes: 24 additions & 0 deletions html_text/i18n/html_text.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr ""

#. module: html_text
#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search
msgid "Smart Search"
msgstr ""
37 changes: 37 additions & 0 deletions html_text/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Paolo Valier <paolo.valier@hotmail.it>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-06 02:25+0000\n"
"PO-Revision-Date: 2025-07-23 17:25+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertitore campi"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"

#~ msgid "Smart Search"
#~ msgstr "Ricerca intelligente"
Loading