From b817bd6b4baeaae30a343f327c42a5ebe66a2030 Mon Sep 17 00:00:00 2001 From: oleksandrpaziuk Date: Tue, 16 Jan 2018 15:01:27 +0200 Subject: [PATCH] [MIG] datetime_formatter: Migration to 11.0 --- datetime_formatter/README.rst | 2 +- datetime_formatter/__init__.py | 1 - datetime_formatter/__manifest__.py | 4 ++-- datetime_formatter/models/__init__.py | 1 - datetime_formatter/models/res_lang.py | 3 +-- datetime_formatter/tests/__init__.py | 1 - datetime_formatter/tests/test_best_matcher.py | 3 +-- datetime_formatter/tests/test_formatter.py | 7 +++---- 8 files changed, 8 insertions(+), 14 deletions(-) diff --git a/datetime_formatter/README.rst b/datetime_formatter/README.rst index 9c777e60f..9c0ef02f1 100644 --- a/datetime_formatter/README.rst +++ b/datetime_formatter/README.rst @@ -37,7 +37,7 @@ If you are a developer, to use this module, you need to: .. 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/10.0 + :target: https://runbot.odoo-community.org/runbot/149/11.0 Bug Tracker =========== diff --git a/datetime_formatter/__init__.py b/datetime_formatter/__init__.py index 491851786..9b1f9857f 100644 --- a/datetime_formatter/__init__.py +++ b/datetime_formatter/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models # Make these easily available for submodules diff --git a/datetime_formatter/__manifest__.py b/datetime_formatter/__manifest__.py index ac84cc5b3..59a27dece 100644 --- a/datetime_formatter/__manifest__.py +++ b/datetime_formatter/__manifest__.py @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- # Copyright 2015, 2017 Jairo Llopis # Copyright 2016 Tecnativa, S.L. - Vicent Cubells +# Copyright 2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Date & Time Formatter", "summary": "Helper functions to give correct format to date[time] fields", - "version": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Tools", "website": "https://www.tecnativa.com", "author": "Grupo ESOC IngenierĂ­a de Servicios, " diff --git a/datetime_formatter/models/__init__.py b/datetime_formatter/models/__init__.py index 30cac48d5..c2af0613e 100644 --- a/datetime_formatter/models/__init__.py +++ b/datetime_formatter/models/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_lang diff --git a/datetime_formatter/models/res_lang.py b/datetime_formatter/models/res_lang.py index 9d3ced04a..de94a79c5 100644 --- a/datetime_formatter/models/res_lang.py +++ b/datetime_formatter/models/res_lang.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015, 2017 Jairo Llopis # Copyright 2016 Tecnativa, S.L. - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -104,7 +103,7 @@ class ResLang(models.Model): template = separator.join(defaults) # Convert str to datetime objects - if isinstance(value, (str, unicode)): + if isinstance(value, str): try: value = fields.Datetime.from_string(value) except ValueError: diff --git a/datetime_formatter/tests/__init__.py b/datetime_formatter/tests/__init__.py index 0192d242f..3ce04bff3 100644 --- a/datetime_formatter/tests/__init__.py +++ b/datetime_formatter/tests/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_best_matcher, test_formatter diff --git a/datetime_formatter/tests/test_best_matcher.py b/datetime_formatter/tests/test_best_matcher.py index 790c70d58..c67560585 100644 --- a/datetime_formatter/tests/test_best_matcher.py +++ b/datetime_formatter/tests/test_best_matcher.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015, 2017 Jairo Llopis # Copyright 2016 Tecnativa, S.L. - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -8,7 +7,7 @@ from odoo.exceptions import UserError class BasicCase(TransactionCase): def setUp(self): - super(BasicCase, self).setUp() + super().setUp() self.langs = ("en_US", "es_ES", "it_IT", "pt_PT", "zh_CN") self.rl = self.env["res.lang"] for lang in self.langs: diff --git a/datetime_formatter/tests/test_formatter.py b/datetime_formatter/tests/test_formatter.py index 1fa451202..dd0024ad7 100644 --- a/datetime_formatter/tests/test_formatter.py +++ b/datetime_formatter/tests/test_formatter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015, 2017 Jairo Llopis # Copyright 2016 Tecnativa, S.L. - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -13,7 +12,7 @@ from ..models.res_lang import MODE_DATE, MODE_TIME, MODE_DATETIME class FormatterCase(TransactionCase): def setUp(self): - super(FormatterCase, self).setUp() + super().setUp() self.rl = self.env["res.lang"] self.bm = self.rl.best_match() self.dt = datetime.datetime.now() @@ -51,10 +50,10 @@ class FormatterCase(TransactionCase): self.assertEqual( self.expected, self.rl.datetime_formatter( - unicode(self.dt_str), + str(self.dt_str), **self.kwargs)) - super(FormatterCase, self).tearDown() + super().tearDown() def test_datetime(self): """Format a datetime."""