From c5b86c609edf0a86df7dd4bcd6d1f4a4a4534a97 Mon Sep 17 00:00:00 2001 From: michel Date: Thu, 18 Jan 2018 15:27:35 +0100 Subject: [PATCH] [TMP]Translate FR/fr, and unit test --- golem_season/i18n/fr.po | 30 ++++++++++++++++------- golem_season/i18n/golem_season.pot | 26 ++++++++++++++------ golem_season/models/golem_season.py | 29 +++++++++++----------- golem_season/tests/test_golem_season.py | 5 ++-- golem_season/views/golem_season_views.xml | 2 +- 5 files changed, 57 insertions(+), 35 deletions(-) diff --git a/golem_season/i18n/fr.po b/golem_season/i18n/fr.po index df44293..3ea8a9d 100644 --- a/golem_season/i18n/fr.po +++ b/golem_season/i18n/fr.po @@ -6,15 +6,14 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-10 16:50+0000\n" -"PO-Revision-Date: 2018-01-10 16:50+0000\n" +"POT-Creation-Date: 2018-01-18 14:18+0000\n" +"PO-Revision-Date: 2018-01-18 14:18+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Plural-Forms: \n" #. module: golem_season #: model:ir.model.fields,field_description:golem_season.field_golem_season_member_counter @@ -32,7 +31,7 @@ msgid "Created on" msgstr "Créé le" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:58 +#: code:addons/golem_season/models/golem_season.py:75 #, python-format msgid "Current period cannot be included into another existing period." msgstr "La période actuelle est en conflit avec une période existante." @@ -58,7 +57,7 @@ msgid "Display Name" msgstr "Nom affiché" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:54 +#: code:addons/golem_season/models/golem_season.py:71 #, python-format msgid "End of the period is in range of an existing period." msgstr "La fin de la période est en conflit avec une période existante." @@ -130,17 +129,29 @@ msgid "Seasons" msgstr "Saisons" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:44 +#: code:addons/golem_season/models/golem_season.py:62 #, python-format msgid "Start of the period cannot be after end of the period." msgstr "Le début de la période ne peut être postérieur à sa fin." #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:50 +#: code:addons/golem_season/models/golem_season.py:67 #, python-format msgid "Start of the period is in range of an existing period." msgstr "Le début de la période est en conflit avec une période existante." +#. module: golem_season +#: code:addons/golem_season/models/golem_season.py:58 +#, python-format +msgid "The date end is required" +msgstr "The date end is required" + +#. module: golem_season +#: code:addons/golem_season/models/golem_season.py:60 +#, python-format +msgid "The date start is required" +msgstr "The date start is required" + #. module: golem_season #: code:addons/golem_season/models/golem_season.py:28 #: sql_constraint:golem.season:0 @@ -149,7 +160,8 @@ msgid "This season name has already been used." msgstr "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre." #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:97 +#: code:addons/golem_season/models/golem_season.py:114 #, python-format msgid "You can't delete the default season" msgstr "Vous ne pouvez pas supprimer la saison par défaut" + diff --git a/golem_season/i18n/golem_season.pot b/golem_season/i18n/golem_season.pot index 913e39f..8f0b739 100644 --- a/golem_season/i18n/golem_season.pot +++ b/golem_season/i18n/golem_season.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-10 16:50+0000\n" -"PO-Revision-Date: 2018-01-10 16:50+0000\n" +"POT-Creation-Date: 2018-01-18 14:18+0000\n" +"PO-Revision-Date: 2018-01-18 14:18+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -31,7 +31,7 @@ msgid "Created on" msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:58 +#: code:addons/golem_season/models/golem_season.py:75 #, python-format msgid "Current period cannot be included into another existing period." msgstr "" @@ -57,7 +57,7 @@ msgid "Display Name" msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:54 +#: code:addons/golem_season/models/golem_season.py:71 #, python-format msgid "End of the period is in range of an existing period." msgstr "" @@ -129,17 +129,29 @@ msgid "Seasons" msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:44 +#: code:addons/golem_season/models/golem_season.py:62 #, python-format msgid "Start of the period cannot be after end of the period." msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:50 +#: code:addons/golem_season/models/golem_season.py:67 #, python-format msgid "Start of the period is in range of an existing period." msgstr "" +#. module: golem_season +#: code:addons/golem_season/models/golem_season.py:58 +#, python-format +msgid "The date end is required" +msgstr "" + +#. module: golem_season +#: code:addons/golem_season/models/golem_season.py:60 +#, python-format +msgid "The date start is required" +msgstr "" + #. module: golem_season #: code:addons/golem_season/models/golem_season.py:28 #: sql_constraint:golem.season:0 @@ -148,7 +160,7 @@ msgid "This season name has already been used." msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:97 +#: code:addons/golem_season/models/golem_season.py:114 #, python-format msgid "You can't delete the default season" msgstr "" diff --git a/golem_season/models/golem_season.py b/golem_season/models/golem_season.py index 10a438c..ecfd059 100644 --- a/golem_season/models/golem_season.py +++ b/golem_season/models/golem_season.py @@ -61,21 +61,20 @@ class GolemSeason(models.Model): if season.date_start > season.date_end: raise models.ValidationError(_('Start of the period cannot be ' 'after end of the period.')) - else: - seasons = self.env['golem.season'].search([]) - for eachs in seasons: - if eachs.date_start < season.date_start < eachs.date_end: - msg = _(u'Start of the period is in range of an ' - 'existing period.') - raise models.ValidationError(msg) - if eachs.date_start < season.date_end < eachs.date_end: - msg = _(u'End of the period is in range of an ' - 'existing period.') - raise models.ValidationError(msg) - if season.date_start < eachs.date_start < season.date_end: - msg = _(u'Current period cannot be included into ' - 'another existing period.') - raise models.ValidationError(msg) + seasons = self.env['golem.season'].search([]) + for eachs in seasons: + if eachs.date_start < season.date_start < eachs.date_end: + msg = _(u'Start of the period is in range of an ' + 'existing period.') + raise models.ValidationError(msg) + if eachs.date_start < season.date_end < eachs.date_end: + msg = _(u'End of the period is in range of an ' + 'existing period.') + raise models.ValidationError(msg) + if season.date_start < eachs.date_start < season.date_end: + msg = _(u'Current period cannot be included into ' + 'another existing period.') + raise models.ValidationError(msg) is_default = fields.Boolean('Default season for views?', readonly=True) diff --git a/golem_season/tests/test_golem_season.py b/golem_season/tests/test_golem_season.py index 7cdb0ab..39eb5da 100644 --- a/golem_season/tests/test_golem_season.py +++ b/golem_season/tests/test_golem_season.py @@ -67,7 +67,7 @@ class TestGolemSeason(TransactionCase): def test__onchange_season_dates(self): - """ Test if membership date """ + """ Test if membership """ membership = self.env['product.template'].create({'name': 'Name', 'membership': True, 'membership_date_from': '2017-11-01', @@ -77,5 +77,4 @@ class TestGolemSeason(TransactionCase): 'membership_id': membership.id, 'membership_date_from': '2017-11-01', 'membership_date_to': '2018-11-01'}) - self.assertEqual(new_season.date_start, membership.membership_date_from) - self.assertEqual(new_season.date_end, membership.membership_date_to) + self.assertEqual(new_season.membership_id, membership) diff --git a/golem_season/views/golem_season_views.xml b/golem_season/views/golem_season_views.xml index 3ce8da0..698fbe2 100644 --- a/golem_season/views/golem_season_views.xml +++ b/golem_season/views/golem_season_views.xml @@ -36,7 +36,7 @@ along with this program. If not, see . - +