From 6bead1323e261e45f7378f59956b7f0b41320597 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 22 Jun 2017 13:08:16 +0200 Subject: [PATCH] [MIG][10.0][html_text] Migrate --- html_text/README.rst | 2 +- html_text/__init__.py | 2 -- html_text/{__openerp__.py => __manifest__.py} | 4 ++-- html_text/models/__init__.py | 2 -- html_text/models/ir_fields_converter.py | 6 +++--- html_text/tests/__init__.py | 1 - html_text/tests/test_extractor.py | 10 +++++++--- 7 files changed, 13 insertions(+), 14 deletions(-) rename html_text/{__openerp__.py => __manifest__.py} (86%) diff --git a/html_text/README.rst b/html_text/README.rst index 52c7755be..59ab65597 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -38,7 +38,7 @@ QWeb example:: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/9.0 + :target: https://runbot.odoo-community.org/runbot/149/10.0 Known issues / Roadmap ====================== diff --git a/html_text/__init__.py b/html_text/__init__.py index 197214cdd..a77a6fcbc 100644 --- a/html_text/__init__.py +++ b/html_text/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis -# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/html_text/__openerp__.py b/html_text/__manifest__.py similarity index 86% rename from html_text/__openerp__.py rename to html_text/__manifest__.py index 173d737a0..af0df87b6 100644 --- a/html_text/__openerp__.py +++ b/html_text/__manifest__.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Tools", "website": "https://tecnativa.com", "author": "Grupo ESOC Ingeniería de Servicios, " diff --git a/html_text/models/__init__.py b/html_text/models/__init__.py index 5746f8b6b..6fcbec0b6 100644 --- a/html_text/models/__init__.py +++ b/html_text/models/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis -# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import ir_fields_converter diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 5180665f0..1e84b1cad 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging from lxml import etree, html -from openerp import api, models +from odoo import api, models _logger = logging.getLogger(__name__) -class IrFieldsConverter(models.Model): +class IrFieldsConverter(models.AbstractModel): _inherit = "ir.fields.converter" @api.model diff --git a/html_text/tests/__init__.py b/html_text/tests/__init__.py index 60346a281..f8ca9e601 100644 --- a/html_text/tests/__init__.py +++ b/html_text/tests/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_extractor diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 22443e32a..938361fd7 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from lxml import etree -from openerp.tests.common import TransactionCase +from odoo.tools import mute_logger +from odoo.tests.common import TransactionCase +from ..models import ir_fields_converter class ExtractorCase(TransactionCase): def setUp(self): super(ExtractorCase, self).setUp() - # Shortcut self.text_from_html = self.env["ir.fields.converter"].text_from_html @@ -40,18 +41,21 @@ class ExtractorCase(TransactionCase): self.text_from_html(html, 7, ellipsis=""), u"I'm a title I'm a paragraph ¡Pues") + @mute_logger(ir_fields_converter.__name__) def test_empty_html(self): """Empty HTML handled correctly.""" self.assertEqual(self.text_from_html(""), "") with self.assertRaises(etree.XMLSyntaxError): self.text_from_html("", fail=True) + @mute_logger(ir_fields_converter.__name__) def test_false_html(self): """``False`` HTML handled correctly.""" self.assertEqual(self.text_from_html(False), "") with self.assertRaises(TypeError): self.text_from_html(False, fail=True) + @mute_logger(ir_fields_converter.__name__) def test_bad_html(self): """Bad HTML handled correctly.""" self.assertEqual(self.text_from_html("<"), "")