Browse Source

[MIG] datetime_formatter: Migration to 11.0

pull/1496/head
oleksandrpaziuk 7 years ago
committed by ernesto
parent
commit
b817bd6b4b
  1. 2
      datetime_formatter/README.rst
  2. 1
      datetime_formatter/__init__.py
  3. 4
      datetime_formatter/__manifest__.py
  4. 1
      datetime_formatter/models/__init__.py
  5. 3
      datetime_formatter/models/res_lang.py
  6. 1
      datetime_formatter/tests/__init__.py
  7. 3
      datetime_formatter/tests/test_best_matcher.py
  8. 7
      datetime_formatter/tests/test_formatter.py

2
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
===========

1
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

4
datetime_formatter/__manifest__.py

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# 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, "

1
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

3
datetime_formatter/models/res_lang.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# 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:

1
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

3
datetime_formatter/tests/test_best_matcher.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# 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:

7
datetime_formatter/tests/test_formatter.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# 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."""

Loading…
Cancel
Save