[MIG] datetime_formatter: Migration to 16.0

pull/2918/head
Carolina Fernandez 2024-04-23 14:21:17 +02:00
parent 927411502d
commit 18a2070a23
6 changed files with 38 additions and 30 deletions

View File

@ -7,7 +7,7 @@ Date & Time Formatter
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f0661c48873ca9ee263251efc9ea3021c506168ef355f4118327a4032091731a
!! source digest: sha256:760f3a57e4213a88271189b876c7d4f6ccf9109efa4b2e0d04cdceaec8807791
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@ -17,13 +17,13 @@ Date & Time Formatter
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/15.0/datetime_formatter
:target: https://github.com/OCA/server-tools/tree/16.0/datetime_formatter
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-datetime_formatter
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-datetime_formatter
: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/server-tools&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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/server-tools/issues/new?body=module:%20datetime_formatter%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20datetime_formatter%0Aversion:%2016.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.
@ -90,6 +90,7 @@ Contributors
* Vicent Cubells
* Ernesto Tejeda
* Víctor Martínez
* Carolina Fernandez
* Tautvydas Banevičius <baneviciustautvydas@gmail.com>
* Dhara Solanki <dhara.solanki@initos.com>
@ -106,6 +107,6 @@ 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.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/15.0/datetime_formatter>`_ project on GitHub.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/datetime_formatter>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -1,12 +1,13 @@
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2018 Camptocamp SA
# Copyright 2024 Tecnativa - Carolina Fernandez
# 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": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
"author": "Grupo ESOC Ingeniería de Servicios, Tecnativa, Odoo Community Association (OCA)",

View File

@ -4,5 +4,6 @@
* Vicent Cubells
* Ernesto Tejeda
* Víctor Martínez
* Carolina Fernandez
* Tautvydas Banevičius <baneviciustautvydas@gmail.com>
* Dhara Solanki <dhara.solanki@initos.com>

View File

@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f0661c48873ca9ee263251efc9ea3021c506168ef355f4118327a4032091731a
!! source digest: sha256:760f3a57e4213a88271189b876c7d4f6ccf9109efa4b2e0d04cdceaec8807791
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/15.0/datetime_formatter"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-datetime_formatter"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/datetime_formatter"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-datetime_formatter"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of Odoo language engine to
support formatting <cite>Date</cite>, <cite>Time</cite> and <cite>Datetime</cite> fields easily and allow you to
print them in the best format for the user.</p>
@ -419,7 +419,7 @@ formatted_string = record.lang.datetime_formatter(record.datetime_field)
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20datetime_formatter%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20datetime_formatter%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -439,6 +439,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Vicent Cubells</li>
<li>Ernesto Tejeda</li>
<li>Víctor Martínez</li>
<li>Carolina Fernandez</li>
</ul>
</li>
<li>Tautvydas Banevičius &lt;<a class="reference external" href="mailto:baneviciustautvydas&#64;gmail.com">baneviciustautvydas&#64;gmail.com</a>&gt;</li>
@ -452,7 +453,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/15.0/datetime_formatter">OCA/server-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/datetime_formatter">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -1,23 +1,25 @@
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase
class BasicCase(TransactionCase):
def setUp(self):
super().setUp()
self.langs = (
self.env.ref("base.lang_en"),
self.env.ref("base.lang_es"),
self.env.ref("base.lang_it"),
self.env.ref("base.lang_pt"),
self.env.ref("base.lang_zh_CN"),
@classmethod
def setUpClass(cls):
super(BasicCase, cls).setUpClass()
cls.langs = (
cls.env.ref("base.lang_en"),
cls.env.ref("base.lang_es"),
cls.env.ref("base.lang_it"),
cls.env.ref("base.lang_pt"),
cls.env.ref("base.lang_zh_CN"),
)
self.rl = self.env["res.lang"]
for lang in self.langs:
self.rl._activate_lang(lang.code)
cls.rl = cls.env["res.lang"]
for lang in cls.langs:
cls.rl._activate_lang(lang.code)
def test_explicit(self):
"""When an explicit lang is used."""

View File

@ -1,5 +1,6 @@
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import datetime
from random import random
@ -15,14 +16,15 @@ from ..models.res_lang import MODE_DATE, MODE_DATETIME, MODE_TIME
class FormatterCase(TransactionCase):
def setUp(self):
super().setUp()
self.rl = self.env["res.lang"]
self.bm = self.rl.best_match()
self.dt = datetime.datetime.now()
self.d_fmt = self.bm.date_format or DEFAULT_SERVER_DATE_FORMAT
self.t_fmt = self.bm.time_format or DEFAULT_SERVER_TIME_FORMAT
self.kwargs = dict()
@classmethod
def setUpClass(cls):
super(FormatterCase, cls).setUpClass()
cls.rl = cls.env["res.lang"]
cls.bm = cls.rl.best_match()
cls.dt = datetime.datetime.now()
cls.d_fmt = cls.bm.date_format or DEFAULT_SERVER_DATE_FORMAT
cls.t_fmt = cls.bm.time_format or DEFAULT_SERVER_TIME_FORMAT
cls.kwargs = dict()
def tearDown(self):
# This should be returned