Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
112 changes: 112 additions & 0 deletions web_export_html_as_text/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=======================
Web Export Html As Text
=======================

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

.. |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%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/19.0/web_export_html_as_text
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_export_html_as_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/web&target_branch=19.0
:alt: Try me on Runboat

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

This module allows exporting HTML fields as plain text.

**Table of contents**

.. contents::
:local:

Configuration
=============

To export HTML fields as plain text:

- Open any list view.
- Select the records, then click Export under the Action menu.
- Enable "Export HTML as text" in the export dialog.

Note: This setting will apply to all HTML fields exported in the current
export dialog.

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

Lists (numbered, bullets, checklists) and rich formatting (bold,
italics, underline, colors, fonts, alignment) from Odoo HTML fields are
not preserved in exports; all are simplified to plain text.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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/web/issues/new?body=module:%20web_export_html_as_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
-------

* Quartile

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

- `Quartile <https://www.quartile.co>`__

- Aung Ko Ko Lin

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.

.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
:target: https://github.com/yostashiro
:alt: yostashiro
.. |maintainer-AungKoKoLin1997| image:: https://github.com/AungKoKoLin1997.png?size=40px
:target: https://github.com/AungKoKoLin1997
:alt: AungKoKoLin1997

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro| |maintainer-AungKoKoLin1997|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/19.0/web_export_html_as_text>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_export_html_as_text/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions web_export_html_as_text/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Web Export Html As Text",
"version": "19.0.1.0.0",
"website": "https://github.com/OCA/web",
"author": "Quartile, Odoo Community Association (OCA)",
"category": "Tools",
"license": "AGPL-3",
"depends": ["base"],
"assets": {
"web.assets_backend": [
"web_export_html_as_text/static/src/js/*.esm.js",
"web_export_html_as_text/static/src/xml/*.xml",
],
},
"maintainers": ["yostashiro", "AungKoKoLin1997"],
"installable": True,
}
29 changes: 29 additions & 0 deletions web_export_html_as_text/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_export_html_as_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-09-18 15:59+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\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: web_export_html_as_text
#: model:ir.model,name:web_export_html_as_text.model_base
msgid "Base"
msgstr "Base"

#. module: web_export_html_as_text
#. odoo-javascript
#: code:addons/web_export_html_as_text/static/src/xml/export_dialog.xml:0
#, python-format
msgid "Export HTML as text"
msgstr "Esporta HTML come testo"
26 changes: 26 additions & 0 deletions web_export_html_as_text/i18n/web_export_html_as_text.pot
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:
# * web_export_html_as_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: web_export_html_as_text
#: model:ir.model,name:web_export_html_as_text.model_base
msgid "Base"
msgstr ""

#. module: web_export_html_as_text
#. odoo-javascript
#: code:addons/web_export_html_as_text/static/src/xml/export_dialog.xml:0
#, python-format
msgid "Export HTML as text"
msgstr ""
1 change: 1 addition & 0 deletions web_export_html_as_text/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
48 changes: 48 additions & 0 deletions web_export_html_as_text/models/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo.models import fix_import_export_id_paths
from odoo.tools import html2plaintext


def _is_html_path(model, path):
if not path or path[0] in ("id", ".id"):
return False
cur_model = model
for i, p in enumerate(path):
fld = cur_model._fields.get(p)
if not fld:
return False
last = i == len(path) - 1
if last:
return getattr(fld, "type", None) == "html"
if getattr(fld, "relational", False):
cur_model = model.env[fld.comodel_name]
else:
return False
return False


class BaseExportHtmlAsText(models.AbstractModel):
_inherit = "base"

@api.model
def export_data(self, fields_to_export):
res = super().export_data(fields_to_export)
if not self.env.context.get("export_html_as_text"):
return res
datas = res.get("datas", [])
if not datas:
return res
fields_to_export = [fix_import_export_id_paths(f) for f in fields_to_export]
html_indexes = [
i for i, p in enumerate(fields_to_export) if _is_html_path(self, p)
]
if not html_indexes:
return res
for row in datas:
for idx in html_indexes:
if isinstance(row[idx], str) and row[idx]:
row[idx] = html2plaintext(row[idx])
return res
3 changes: 3 additions & 0 deletions web_export_html_as_text/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
8 changes: 8 additions & 0 deletions web_export_html_as_text/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To export HTML fields as plain text:

- Open any list view.
- Select the records, then click Export under the Action menu.
- Enable "Export HTML as text" in the export dialog.

Note: This setting will apply to all HTML fields exported in the current
export dialog.
2 changes: 2 additions & 0 deletions web_export_html_as_text/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Quartile](https://www.quartile.co)
- Aung Ko Ko Lin
1 change: 1 addition & 0 deletions web_export_html_as_text/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows exporting HTML fields as plain text.
3 changes: 3 additions & 0 deletions web_export_html_as_text/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Lists (numbered, bullets, checklists) and rich formatting (bold,
italics, underline, colors, fonts, alignment) from Odoo HTML fields are
not preserved in exports; all are simplified to plain text.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading