diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index 808033ad94e593429451a27371d99dc1ffe84dfa..c75e36aa9616a293d59b30e03a3d5927148abb11 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from odoo import api, fields, models, Command, _ +from odoo import api, fields, models, Command, tools, _ from odoo.tools import float_compare, float_is_zero from odoo.osv.expression import get_unaccent_wrapper from odoo.exceptions import UserError, ValidationError @@ -8,7 +8,6 @@ import re from math import copysign from collections import defaultdict from dateutil.relativedelta import relativedelta -import html2text class AccountReconcileModelPartnerMapping(models.Model): @@ -767,7 +766,7 @@ class AccountReconcileModel(models.Model): for partner_mapping in self.partner_mapping_line_ids: match_payment_ref = re.match(partner_mapping.payment_ref_regex, st_line.payment_ref) if partner_mapping.payment_ref_regex else True - match_narration = re.match(partner_mapping.narration_regex, html2text.html2text(st_line.narration or '').rstrip()) if partner_mapping.narration_regex else True + match_narration = re.match(partner_mapping.narration_regex, tools.html2plaintext(st_line.narration or '').rstrip()) if partner_mapping.narration_regex else True if match_payment_ref and match_narration: return partner_mapping.partner_id diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh index f28ba2e879f940e99b60a7e1f17e9b5c86d4494f..8e6c666a2e95bed208690223e51f1538e2a4b986 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh @@ -52,7 +52,6 @@ PKGS_TO_INSTALL=" python3-decorator \ python3-dev \ python3-docutils \ - python3-html2text \ python3-jinja2 \ python3-ldap \ python3-libsass \ diff --git a/debian/control b/debian/control index 0350cb4cd8b92ee943c5ec2e4260c7b55ba4ceeb..2016cd55b76973fe19f1eccb296ad06b95be1785 100644 --- a/debian/control +++ b/debian/control @@ -30,7 +30,6 @@ Depends: python3-decorator, python3-docutils, python3-freezegun, - python3-html2text, python3-pil, python3-jinja2, python3-libsass, diff --git a/odoo/addons/base/models/ir_mail_server.py b/odoo/addons/base/models/ir_mail_server.py index f3b706f6ad747483cbc471fe9a0787d13fb5afef..f0a7b09bc85fd3ebdc7fd27173c36121496e586c 100644 --- a/odoo/addons/base/models/ir_mail_server.py +++ b/odoo/addons/base/models/ir_mail_server.py @@ -7,7 +7,6 @@ import base64 import datetime import email import email.policy -import html2text import idna import logging import re @@ -396,7 +395,7 @@ class IrMailServer(models.Model): email_body = ustr(body) if subtype == 'html' and not body_alternative: - msg.add_alternative(html2text.html2text(email_body), subtype='plain', charset='utf-8') + msg.add_alternative(tools.html2plaintext(email_body), subtype='plain', charset='utf-8') msg.add_alternative(email_body, subtype=subtype, charset='utf-8') elif body_alternative: msg.add_alternative(ustr(body_alternative), subtype=subtype_alternative, charset='utf-8') diff --git a/odoo/addons/base/tests/test_ir_mail_server.py b/odoo/addons/base/tests/test_ir_mail_server.py index 65d51f09c8f65bbfcc859d517a890d20686780a5..66d5d13f7c0ce1c98e789116b12e8ed37e4f0399 100644 --- a/odoo/addons/base/tests/test_ir_mail_server.py +++ b/odoo/addons/base/tests/test_ir_mail_server.py @@ -65,8 +65,8 @@ class TestIrMailServer(TransactionCase, MockSmtplibCase): 'content', 'content', 'content', - "test1\n\n**test2**\n\n_test3_\n\n_test4_\n\n~~test5~~\n\ntest6\n\n * test7\n * test8\n\n 1. test9\n 2. test10\n\n> test11\n\n> > test12\n>>\n\n>> \n>\n\n[google](http://google.com) [test link](javascript:alert\('malicious code'\))", - 'On 01/05/2016 10:24 AM, Raoul Poilvache wrote: \n\n> **_Test reply. The suite._** \n>\n>\n> \n>\n>\n> \-- \n>\n>\n> Raoul Poilvache\n\nTop cool !!! \n \n\n \n \n -- \n Raoul Poilvache\n ', + "test1\n*test2*\ntest3\ntest4\ntest5\ntest6 test7\ntest8 test9\ntest10\ntest11\ntest12\ngoogle [1]\ntest link [2]\n\n\n[1] http://google.com\n[2] javascript:alert('malicious code')", + 'On 01/05/2016 10:24 AM, Raoul\nPoilvache wrote:\n\n* Test reply. The suite. *\n\n--\nRaoul Poilvache\n\nTop cool !!!\n\n--\nRaoul Poilvache', ] for body, expected in zip(bodies, expected_list): message = self.env['ir.mail_server'].build_email( diff --git a/requirements.txt b/requirements.txt index 5d3236adf4356928d1d146c09510e17721ce31d9..b02b28639d567cd9bfa02289877fabf2ff0876c3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,6 @@ gevent==1.5.0 ; python_version == '3.7' gevent==20.9.0 ; python_version >= '3.8' greenlet==0.4.15 ; python_version == '3.7' greenlet==0.4.17 ; python_version > '3.7' -html2text==2020.1.16 idna==2.8 Jinja2==2.10.1; python_version < '3.8' # bullseye version, focal patched 2.10 diff --git a/setup.cfg b/setup.cfg index 78003c4d8097ac0a1694b68411b4442d4df93a2f..c97694bffc05536b13bb17cb78cac6ebf07862f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,6 @@ requires = python3-freezegun python3-gevent python3-greenlet - python3-html2text python3-idna python3-jinja2 python3-lxml diff --git a/setup.py b/setup.py index da7b4eb8dff916817679ee89ff77b108f77a4127..ced4ee02e0de0788be3430c95a1aff69bd94f06f 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,6 @@ setup( 'decorator', 'docutils', 'gevent', - 'html2text', 'idna', 'Jinja2', 'lxml', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/ diff --git a/setup/package.dfdebian b/setup/package.dfdebian index 853a725856483574b4c892772191b3f360122550..6e110b66d112e78f53dcba9eab64bc52bd4458fd 100644 --- a/setup/package.dfdebian +++ b/setup/package.dfdebian @@ -28,7 +28,6 @@ RUN apt-get update -qq && \ python3-decorator \ python3-docutils \ python3-gevent \ - python3-html2text \ python3-pil \ python3-jinja2 \ python3-libsass \ diff --git a/setup/package.dffedora b/setup/package.dffedora index ce1537fcd159f73bc0d8260fada587a481c12878..e71dfcc0a4363971bcc0ccaf0b99ba34ea20f1d5 100644 --- a/setup/package.dffedora +++ b/setup/package.dffedora @@ -21,7 +21,6 @@ RUN dnf update -d 0 -e 0 -y && \ python3-freezegun \ python3-gevent \ python3-greenlet \ - python3-html2text \ python3-idna \ python3-jinja2 \ python3-lxml \