From c18b0a20a773e19a6b764a3efc0f381282c9f80d Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Fri, 20 Jul 2018 10:09:24 +0200 Subject: [PATCH] [REF]Huge refactoring around is_current / default season Not computed anymore Replaced is_current by more coherent is_default Not seen current season only per default. --- golem_activity/__manifest__.py | 2 +- golem_activity/i18n/fr.po | 42 ++++++++++------- golem_activity/i18n/golem_activity.pot | 42 ++++++++++------- golem_activity/models/golem_activity.py | 37 ++++++++++----- golem_activity/tests/test_golem_activity.py | 4 +- golem_activity/views/golem_activity_views.xml | 5 +- golem_activity_queue/__manifest__.py | 2 +- golem_activity_queue/i18n/fr.po | 17 +++---- .../i18n/golem_activity_queue.pot | 14 +++--- .../models/golem_activity_queue.py | 3 +- .../views/golem_activity_queue_views.xml | 7 ++- .../views/golem_member_views.xml | 2 +- golem_activity_registration/__manifest__.py | 2 +- golem_activity_registration/i18n/fr.po | 32 +++++-------- .../i18n/golem_activity_registration.pot | 33 ++++++------- .../models/golem_activity_registration.py | 33 ++++++------- .../golem_activity_registration_views.xml | 7 ++- .../views/golem_member_views.xml | 2 +- golem_member/__manifest__.py | 2 +- golem_member/i18n/fr.po | 47 ++++++++++++------- golem_member/i18n/golem_member.pot | 41 ++++++++++------ golem_member/models/__init__.py | 4 +- golem_member/models/golem_member.py | 28 ++++++++--- golem_member/models/golem_season.py | 37 +++++++++++++++ golem_member/tests/test_golem_member.py | 20 ++++---- golem_member/views/golem_member_views.xml | 5 +- golem_membership/i18n/fr.po | 8 ++-- golem_membership/i18n/golem_membership.pot | 8 ++-- golem_season/__manifest__.py | 2 +- golem_season/i18n/fr.po | 21 +++++---- golem_season/i18n/golem_season.pot | 20 ++++---- golem_season/models/golem_season.py | 15 +----- 32 files changed, 310 insertions(+), 234 deletions(-) create mode 100644 golem_member/models/golem_season.py diff --git a/golem_activity/__manifest__.py b/golem_activity/__manifest__.py index 20f984d..7c9992b 100644 --- a/golem_activity/__manifest__.py +++ b/golem_activity/__manifest__.py @@ -19,7 +19,7 @@ 'name': 'GOLEM activities', 'summary': 'Extends Odoo products for multi-activity', 'description': 'Extends Odoo products for multi-activity', - 'version': '10.0.2.3.2', + 'version': '10.0.2.4.0', 'category': 'GOLEM', 'author': 'Fabien Bourgeois, Michel Dessenne', 'license': 'AGPL-3', diff --git a/golem_activity/i18n/fr.po b/golem_activity/i18n/fr.po index c4878c1..e1e3a5b 100644 --- a/golem_activity/i18n/fr.po +++ b/golem_activity/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 08:44+0000\n" -"PO-Revision-Date: 2018-07-17 10:44+0200\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 10:04+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -173,13 +173,13 @@ msgid "Activity audience" msgstr "Public" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:142 +#: code:addons/golem_activity/models/golem_activity.py:157 #, python-format msgid "Activity end date can not be set after linked season end." msgstr "La date de fin ne peut pas être apprêt la date de fin de la saison." #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:138 +#: code:addons/golem_activity/models/golem_activity.py:153 #, python-format msgid "Activity start date can not be set before linked season start." msgstr "La date de début ne peut pas être avant la date de début de la saison." @@ -319,11 +319,6 @@ msgstr "Créé le" msgid "Currency" msgstr "Devise" -#. module: golem_activity -#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_current -msgid "Current season?" -msgstr "Saison en cours?" - #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_taxes_id msgid "Customer Taxes" @@ -369,6 +364,11 @@ msgstr "Unité de mesure par défaut pour les ordres d'achat. Elle doit apparten msgid "Default season" msgstr "Saison par défaut" +#. module: golem_activity +#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_default +msgid "Default season?" +msgstr "Saison par défaut?" + #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_description msgid "Description" @@ -392,7 +392,7 @@ msgid "Expense Account" msgstr "Compte de dépenses" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:160 +#: code:addons/golem_activity/models/golem_activity.py:175 #: selection:golem.activity,weekday:0 #, python-format msgid "Friday" @@ -563,7 +563,7 @@ msgid "Membership Start Date" msgstr "Date de début d'adhésion" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:156 +#: code:addons/golem_activity/models/golem_activity.py:171 #: selection:golem.activity,weekday:0 #, python-format msgid "Monday" @@ -657,7 +657,7 @@ msgid "Sale Price" msgstr "Prix de vente" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:161 +#: code:addons/golem_activity/models/golem_activity.py:176 #: selection:golem.activity,weekday:0 #, python-format msgid "Saturday" @@ -710,8 +710,8 @@ msgid "Start date" msgstr "Date de début" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:135 -#: code:addons/golem_activity/models/golem_activity.py:178 +#: code:addons/golem_activity/models/golem_activity.py:150 +#: code:addons/golem_activity/models/golem_activity.py:193 #, 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 antérieure à sa fin" @@ -727,7 +727,7 @@ msgid "Stop time" msgstr "Heure de fin" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:162 +#: code:addons/golem_activity/models/golem_activity.py:177 #: selection:golem.activity,weekday:0 #, python-format msgid "Sunday" @@ -778,7 +778,7 @@ msgid "This field holds the image used as image for the activity." msgstr "This field holds the image used as image for the activity." #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:159 +#: code:addons/golem_activity/models/golem_activity.py:174 #: selection:golem.activity,weekday:0 #, python-format msgid "Thursday" @@ -795,7 +795,7 @@ msgid "True" msgstr "True" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:157 +#: code:addons/golem_activity/models/golem_activity.py:172 #: selection:golem.activity,weekday:0 #, python-format msgid "Tuesday" @@ -812,6 +812,12 @@ msgstr "Type" msgid "Unit of Measure" msgstr "Unité de mesure" +#. module: golem_activity +#: code:addons/golem_activity/models/golem_activity.py:123 +#, python-format +msgid "Unsupported operator for defautl season search" +msgstr "Opérateur de recherche non supporté pour le filtre de la saison par défaut" + #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_supplier_taxes_id msgid "Vendor Taxes" @@ -833,7 +839,7 @@ msgid "Warranty" msgstr "Garantie" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:158 +#: code:addons/golem_activity/models/golem_activity.py:173 #: selection:golem.activity,weekday:0 #, python-format msgid "Wednesday" diff --git a/golem_activity/i18n/golem_activity.pot b/golem_activity/i18n/golem_activity.pot index f28604b..85b9806 100644 --- a/golem_activity/i18n/golem_activity.pot +++ b/golem_activity/i18n/golem_activity.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 08:44+0000\n" -"PO-Revision-Date: 2018-07-17 08:44+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 07:46+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -170,13 +170,13 @@ msgid "Activity audience" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:142 +#: code:addons/golem_activity/models/golem_activity.py:157 #, python-format msgid "Activity end date can not be set after linked season end." msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:138 +#: code:addons/golem_activity/models/golem_activity.py:153 #, python-format msgid "Activity start date can not be set before linked season start." msgstr "" @@ -316,11 +316,6 @@ msgstr "" msgid "Currency" msgstr "" -#. module: golem_activity -#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_current -msgid "Current season?" -msgstr "" - #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_taxes_id msgid "Customer Taxes" @@ -366,6 +361,11 @@ msgstr "" msgid "Default season" msgstr "" +#. module: golem_activity +#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_default +msgid "Default season?" +msgstr "" + #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_description msgid "Description" @@ -389,7 +389,7 @@ msgid "Expense Account" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:160 +#: code:addons/golem_activity/models/golem_activity.py:175 #: selection:golem.activity,weekday:0 #, python-format msgid "Friday" @@ -560,7 +560,7 @@ msgid "Membership Start Date" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:156 +#: code:addons/golem_activity/models/golem_activity.py:171 #: selection:golem.activity,weekday:0 #, python-format msgid "Monday" @@ -654,7 +654,7 @@ msgid "Sale Price" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:161 +#: code:addons/golem_activity/models/golem_activity.py:176 #: selection:golem.activity,weekday:0 #, python-format msgid "Saturday" @@ -707,8 +707,8 @@ msgid "Start date" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:135 -#: code:addons/golem_activity/models/golem_activity.py:178 +#: code:addons/golem_activity/models/golem_activity.py:150 +#: code:addons/golem_activity/models/golem_activity.py:193 #, python-format msgid "Start of the period cannot be after end of the period." msgstr "" @@ -724,7 +724,7 @@ msgid "Stop time" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:162 +#: code:addons/golem_activity/models/golem_activity.py:177 #: selection:golem.activity,weekday:0 #, python-format msgid "Sunday" @@ -775,7 +775,7 @@ msgid "This field holds the image used as image for the activity." msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:159 +#: code:addons/golem_activity/models/golem_activity.py:174 #: selection:golem.activity,weekday:0 #, python-format msgid "Thursday" @@ -792,7 +792,7 @@ msgid "True" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:157 +#: code:addons/golem_activity/models/golem_activity.py:172 #: selection:golem.activity,weekday:0 #, python-format msgid "Tuesday" @@ -809,6 +809,12 @@ msgstr "" msgid "Unit of Measure" msgstr "" +#. module: golem_activity +#: code:addons/golem_activity/models/golem_activity.py:123 +#, python-format +msgid "Unsupported operator for defautl season search" +msgstr "" + #. module: golem_activity #: model:ir.model.fields,field_description:golem_activity.field_golem_activity_supplier_taxes_id msgid "Vendor Taxes" @@ -830,7 +836,7 @@ msgid "Warranty" msgstr "" #. module: golem_activity -#: code:addons/golem_activity/models/golem_activity.py:158 +#: code:addons/golem_activity/models/golem_activity.py:173 #: selection:golem.activity,weekday:0 #, python-format msgid "Wednesday" diff --git a/golem_activity/models/golem_activity.py b/golem_activity/models/golem_activity.py index 8749fb0..af16c56 100644 --- a/golem_activity/models/golem_activity.py +++ b/golem_activity/models/golem_activity.py @@ -61,7 +61,8 @@ class GolemActivity(models.Model): is_fullseason = fields.Boolean('Is full season?', compute='_compute_is_full_season') location = fields.Char() - audience_id = fields.Many2one('golem.activity.audience', string='Audience') + audience_id = fields.Many2one('golem.activity.audience', string='Audience', + index=True, auto_join=True) @api.onchange('is_fullseason') def onchange_fullseason(self): @@ -91,29 +92,43 @@ class GolemActivity(models.Model): activity.full_name = full_name @api.model - def _default_season(self): + def default_season(self): """ Get default season """ domain = [('is_default', '=', True)] return self.env['golem.season'].search(domain) season_id = fields.Many2one('golem.season', string='Season', copy=False, - required=True, default=_default_season, + required=True, default=default_season, + index=True, auto_join=True, ondelete='restrict') - - is_current = fields.Boolean('Current season?', store=True, default=False, - compute='_compute_is_current') + is_default = fields.Boolean('Default season?', + compute='_compute_is_default', + search='_search_is_default') @api.depends('season_id') - def _compute_is_current(self): - """ Checks if activity is active for current season """ - default_season = self._default_season() + def _compute_is_default(self): + """ Checks if activity is active for default season """ + default_season = self.default_season() for activity in self: - activity.is_current = (default_season == activity.season_id) + activity.is_default = (default_season == activity.season_id) + + @api.multi + def _search_is_default(self, operator, value): + """ Search function for is default """ + if operator in ('in', '='): + operator = '=' if value else '!=' + elif operator in ('not in', '!='): + operator = '!=' if value else '=' + else: + err = _('Unsupported operator for defautl season search') + raise NotImplementedError(err) + return [('season_id', operator, self.default_season().id)] animator_id = fields.Many2one('res.partner', string='Animator', + index=True, auto_join=True, domain=[('is_company', '=', False)]) type_id = fields.Many2one('golem.activity.type', required=True, index=True, - string='Type') + auto_join=True, string='Type') is_recurrent = fields.Boolean(related='type_id.is_recurrent') date_start = fields.Date('Start date', copy=False) date_stop = fields.Date('End date', copy=False) diff --git a/golem_activity/tests/test_golem_activity.py b/golem_activity/tests/test_golem_activity.py index 4bd8945..e48617c 100644 --- a/golem_activity/tests/test_golem_activity.py +++ b/golem_activity/tests/test_golem_activity.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Fabien Bourgeois +# Copyright 2016-2018 Fabien Bourgeois # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -40,7 +40,7 @@ class GolemActivityTestCase(TransactionCase): self.assertEqual(a1.name, 'a1') self.assertEqual(a1.date_start, self.season_current.date_start) self.assertEqual(a1.date_end, self.season_current.date_end) - self.assertTrue(a1.is_current) + self.assertTrue(a1.is_default) adata.update({'name': 'a2', 'date_start': '2010-01-01', 'date_end': '2009-12-01'}) with self.assertRaises(ValidationError): diff --git a/golem_activity/views/golem_activity_views.xml b/golem_activity/views/golem_activity_views.xml index 70e3cfb..7447cc4 100644 --- a/golem_activity/views/golem_activity_views.xml +++ b/golem_activity/views/golem_activity_views.xml @@ -169,7 +169,7 @@ along with this program. If not, see . + domain="[('is_default', '=', True)]" /> @@ -186,8 +186,7 @@ along with this program. If not, see . + res_model="golem.activity" view_mode="tree,form,calendar" /> \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -98,16 +98,16 @@ msgstr "Créé par" msgid "Created on" msgstr "Créé le" -#. module: golem_activity_queue -#: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_queue_is_current -msgid "Current season?" -msgstr "Saison en cours?" - #. module: golem_activity_queue #: model:ir.ui.view,arch_db:golem_activity_queue.golem_activity_queue_view_search msgid "Default season" msgstr "Saison par défaut" +#. module: golem_activity_queue +#: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_queue_is_default +msgid "Default season?" +msgstr "Saison par défaut?" + #. module: golem_activity_queue #: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_automated_queue_activate_wizard_display_name #: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_queue_display_name @@ -247,7 +247,7 @@ msgid "Switch to manual registration from queue" msgstr "Passer à une inscription manuelle depuis la liste d'attente" #. module: golem_activity_queue -#: code:addons/golem_activity_queue/models/golem_activity_queue.py:52 +#: code:addons/golem_activity_queue/models/golem_activity_queue.py:51 #, python-format msgid "The member your trying to add to the queue is already registered for this activity" msgstr "L'adhérent que vous essayez d'ajouter à la liste d'attente est déjà inscrit à cette activité" @@ -289,3 +289,4 @@ msgstr "Attention" #: model:ir.model,name:golem_activity_queue.model_golem_activity_automated_queue_activate_wizard msgid "golem.activity.automated.queue.activate.wizard" msgstr "golem.activity.automated.queue.activate.wizard" + diff --git a/golem_activity_queue/i18n/golem_activity_queue.pot b/golem_activity_queue/i18n/golem_activity_queue.pot index a65633b..a88adbb 100644 --- a/golem_activity_queue/i18n/golem_activity_queue.pot +++ b/golem_activity_queue/i18n/golem_activity_queue.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-07 18:54+0000\n" -"PO-Revision-Date: 2018-03-07 18:54+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 07:46+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -98,13 +98,13 @@ msgid "Created on" msgstr "" #. module: golem_activity_queue -#: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_queue_is_current -msgid "Current season?" +#: model:ir.ui.view,arch_db:golem_activity_queue.golem_activity_queue_view_search +msgid "Default season" msgstr "" #. module: golem_activity_queue -#: model:ir.ui.view,arch_db:golem_activity_queue.golem_activity_queue_view_search -msgid "Default season" +#: model:ir.model.fields,field_description:golem_activity_queue.field_golem_activity_queue_is_default +msgid "Default season?" msgstr "" #. module: golem_activity_queue @@ -246,7 +246,7 @@ msgid "Switch to manual registration from queue" msgstr "" #. module: golem_activity_queue -#: code:addons/golem_activity_queue/models/golem_activity_queue.py:52 +#: code:addons/golem_activity_queue/models/golem_activity_queue.py:51 #, python-format msgid "The member your trying to add to the queue is already registered for this activity" msgstr "" diff --git a/golem_activity_queue/models/golem_activity_queue.py b/golem_activity_queue/models/golem_activity_queue.py index fd41edb..42662c1 100644 --- a/golem_activity_queue/models/golem_activity_queue.py +++ b/golem_activity_queue/models/golem_activity_queue.py @@ -36,8 +36,7 @@ class GolemActivityQueue(models.Model): string='Activity', ondelete='cascade', index=True) season_id = fields.Many2one(related='activity_id.season_id') - is_current = fields.Boolean('Current season?', - related='activity_id.is_current', store=True) + is_default = fields.Boolean(related='activity_id.is_default') places_remain = fields.Integer(related='activity_id.places_remain') sequence = fields.Integer() diff --git a/golem_activity_queue/views/golem_activity_queue_views.xml b/golem_activity_queue/views/golem_activity_queue_views.xml index 8df637f..75b2165 100644 --- a/golem_activity_queue/views/golem_activity_queue_views.xml +++ b/golem_activity_queue/views/golem_activity_queue_views.xml @@ -47,7 +47,7 @@ along with this program. If not, see . + domain="[('is_default', '=', True)]" /> @@ -73,7 +73,7 @@ along with this program. If not, see . @@ -84,8 +84,7 @@ along with this program. If not, see . + res_model="golem.activity.queue" view_mode="tree" /> . diff --git a/golem_activity_registration/__manifest__.py b/golem_activity_registration/__manifest__.py index 2c6ac14..4abec69 100644 --- a/golem_activity_registration/__manifest__.py +++ b/golem_activity_registration/__manifest__.py @@ -18,7 +18,7 @@ { 'name': 'GOLEM Activity Member Registrations', 'summary': 'GOLEM Activities Member Registrations management', - 'version': '10.0.1.2.1', + 'version': '10.0.1.3.0', 'category': 'GOLEM', 'author': 'Fabien Bourgeois, Michel Dessenne', 'license': 'AGPL-3', diff --git a/golem_activity_registration/i18n/fr.po b/golem_activity_registration/i18n/fr.po index eece1b6..851a105 100644 --- a/golem_activity_registration/i18n/fr.po +++ b/golem_activity_registration/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-06-12 14:17+0000\n" -"PO-Revision-Date: 2018-06-12 16:18+0200\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 10:07+0200\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_activity_registration #: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_report_template_inherited_golem_activity_registration @@ -38,7 +37,7 @@ msgstr "Ville" #. module: golem_activity_registration #: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_report_template_inherited_golem_activity_registration -msgid "Name" +msgid " Name" msgstr "Nom" #. module: golem_activity_registration @@ -47,6 +46,11 @@ msgstr "Nom" msgid "Activities" msgstr "Activités" +#. module: golem_activity_registration +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids +msgid "Activities for default season" +msgstr "Activités de la saison par défaut" + #. module: golem_activity_registration #: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_activity_id msgid "Activity" @@ -92,16 +96,6 @@ msgstr "Créé par" msgid "Created on" msgstr "Créé le" -#. module: golem_activity_registration -#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids -msgid "Current activities" -msgstr "Activités de la saison affichée par défaut" - -#. module: golem_activity_registration -#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_is_current -msgid "Current season?" -msgstr "Saison en cours?" - #. module: golem_activity_registration #: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_card_template_inherit_golem_activity_resgitration msgid "Date start" @@ -209,7 +203,7 @@ msgid "Name" msgstr "Nom" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:38 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:39 #: sql_constraint:golem.activity:0 #, python-format msgid "Number of places cannot be negative." @@ -246,7 +240,7 @@ msgid "Season" msgstr "Saison" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:69 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:70 #, python-format msgid "Sorry, there is no more place !" msgstr "Désolé, il n'y a plus de place disponible !" @@ -257,13 +251,13 @@ msgid "Subscription" msgstr "Inscription" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:99 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:100 #, python-format msgid "Subscription can not be executed : the targeted member is not on the same season as the activity." msgstr "L'inscription n'a pas pu être enregistrée : l'usager visé n'est pas ahdérant pour la même saison que celle pendant laquelle se déroule l'activité." #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:91 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:92 #: sql_constraint:golem.activity.registration:0 #, python-format msgid "This member has already been registered for this activity." diff --git a/golem_activity_registration/i18n/golem_activity_registration.pot b/golem_activity_registration/i18n/golem_activity_registration.pot index 5eaf49b..d79479d 100644 --- a/golem_activity_registration/i18n/golem_activity_registration.pot +++ b/golem_activity_registration/i18n/golem_activity_registration.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-12 14:17+0000\n" -"PO-Revision-Date: 2018-06-12 14:17+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 07:46+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -37,7 +37,7 @@ msgstr "" #. module: golem_activity_registration #: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_report_template_inherited_golem_activity_registration -msgid "Name" +msgid " Name" msgstr "" #. module: golem_activity_registration @@ -46,6 +46,11 @@ msgstr "" msgid "Activities" msgstr "" +#. module: golem_activity_registration +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids +msgid "Activities for default season" +msgstr "" + #. module: golem_activity_registration #: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_activity_id msgid "Activity" @@ -91,16 +96,6 @@ msgstr "" msgid "Created on" msgstr "" -#. module: golem_activity_registration -#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids -msgid "Current activities" -msgstr "" - -#. module: golem_activity_registration -#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_is_current -msgid "Current season?" -msgstr "" - #. module: golem_activity_registration #: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_card_template_inherit_golem_activity_resgitration msgid "Date start" @@ -117,8 +112,8 @@ msgid "Day" msgstr "" #. module: golem_activity_registration -#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_registration_search -msgid "Default season" +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_is_default +msgid "Default season?" msgstr "" #. module: golem_activity_registration @@ -208,7 +203,7 @@ msgid "Name" msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:38 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:39 #: sql_constraint:golem.activity:0 #, python-format msgid "Number of places cannot be negative." @@ -245,7 +240,7 @@ msgid "Season" msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:69 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:70 #, python-format msgid "Sorry, there is no more place !" msgstr "" @@ -256,13 +251,13 @@ msgid "Subscription" msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:99 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:100 #, python-format msgid "Subscription can not be executed : the targeted member is not on the same season as the activity." msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:91 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:92 #: sql_constraint:golem.activity.registration:0 #, python-format msgid "This member has already been registered for this activity." diff --git a/golem_activity_registration/models/golem_activity_registration.py b/golem_activity_registration/models/golem_activity_registration.py index 4b791df..37f8ea7 100644 --- a/golem_activity_registration/models/golem_activity_registration.py +++ b/golem_activity_registration/models/golem_activity_registration.py @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- - -# copyright 2017 fabien bourgeois # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu affero general public license as -# published by the free software foundation, either version 3 of the -# license, or (at your option) any later version. +# Copyright 2017-2018 Fabien Bourgeois # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu affero general public license for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # -# you should have received a copy of the gnu affero general public license -# along with this program. if not, see . +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . """ GOLEM Activity Registration """ @@ -24,8 +24,9 @@ class GolemMember(models.Model): _inherit = 'golem.member' activity_registration_ids = fields.One2many('golem.activity.registration', - 'member_id', 'Current activities', - domain=[('is_current', '=', True)]) + 'member_id', + 'Activities for default season', + domain=[('is_default', '=', True)]) activity_registration_all_ids = fields.One2many('golem.activity.registration', 'member_id', 'All activities') @@ -83,8 +84,8 @@ class GolemActivityRegistration(models.Model): activity_price = fields.Float(related='activity_id.list_price') season_id = fields.Many2one(string='Season', related='activity_id.season_id', store=True) - is_current = fields.Boolean('Current season?', - related='activity_id.is_current', store=True) + is_default = fields.Boolean('Default season?', + related='activity_id.is_default') _sql_constraints = [ ('registration_uniq', 'UNIQUE (member_id, activity_id)', diff --git a/golem_activity_registration/views/golem_activity_registration_views.xml b/golem_activity_registration/views/golem_activity_registration_views.xml index 236ebf6..7288c1c 100644 --- a/golem_activity_registration/views/golem_activity_registration_views.xml +++ b/golem_activity_registration/views/golem_activity_registration_views.xml @@ -44,8 +44,8 @@ along with this program. If not, see . - - + + @@ -60,7 +60,7 @@ along with this program. If not, see . + domain="[('is_default', '=', True)]" /> @@ -72,7 +72,6 @@ along with this program. If not, see . GOLEM Activity Registration List golem.activity.registration tree - {'search_default_season_default': True} diff --git a/golem_activity_registration/views/golem_member_views.xml b/golem_activity_registration/views/golem_member_views.xml index 04ce4c1..0efc998 100644 --- a/golem_activity_registration/views/golem_member_views.xml +++ b/golem_activity_registration/views/golem_member_views.xml @@ -34,7 +34,7 @@ along with this program. If not, see . context="{'default_member_id': active_id}"> + domain="[('is_default', '=', True)]" /> diff --git a/golem_member/__manifest__.py b/golem_member/__manifest__.py index e1e8980..e8bc30d 100644 --- a/golem_member/__manifest__.py +++ b/golem_member/__manifest__.py @@ -20,7 +20,7 @@ 'name': 'GOLEM non-profit members', 'summary': 'Extends Odoo contacts for MJC', 'description': 'Extends Odoo contacts for MJC', - 'version': '10.0.1.2.2', + 'version': '10.0.1.3.0', 'category': 'GOLEM', 'author': 'Fabien Bourgeois, Michel Dessenne', 'license': 'AGPL-3', diff --git a/golem_member/i18n/fr.po b/golem_member/i18n/fr.po index 38286bc..64ddd45 100644 --- a/golem_member/i18n/fr.po +++ b/golem_member/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 06:55+0000\n" -"PO-Revision-Date: 2018-07-17 09:01+0200\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 10:03+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -283,11 +283,6 @@ msgstr "Devise" msgid "Current Membership Status" msgstr "État actuel de l'adhésion" -#. module: golem_member -#: model:ir.model.fields,field_description:golem_member.field_golem_member_is_current -msgid "Current user?" -msgstr "Adhérent de cette saison?" - #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_property_payment_term_id msgid "Customer Payment Terms" @@ -318,6 +313,11 @@ msgstr "Date jusqu'à laquelle l'adhésion reste active." msgid "Default season" msgstr "Saison par défaut" +#. module: golem_member +#: model:ir.model.fields,field_description:golem_member.field_golem_member_is_default +msgid "Default season?" +msgstr "Usager de la saison par défaut?" + #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_trust msgid "Degree of trust you have in this debtor" @@ -338,7 +338,7 @@ msgstr "Nom affiché" #. module: golem_member #: model:ir.model.fields,help:golem_member.field_golem_member_partner_share msgid "Either customer (no user), either shared user. Indicated the current partner is a customer without access or with a limited access created for sharing data." -msgstr "Soit un contact (pas un utilisateur), soit un utilisateur partagé. Indique que le contact actuel est un client sans permission ou avec des accès limités créés pour partager des données." +msgstr "Either customer (no user), either shared user. Indicated the current partner is a customer without access or with a limited access created for sharing data." #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_electronic_processing_agreement @@ -366,7 +366,7 @@ msgid "Fax" msgstr "Fax" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:39 +#: code:addons/golem_member/models/golem_member.py:40 #, python-format msgid "Female" msgstr "Féminin" @@ -438,11 +438,16 @@ msgid "GOLEM Members Tags" msgstr "Catégories d'adhérents" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:318 +#: code:addons/golem_member/models/golem_member.py:334 #, python-format msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging." msgstr "La fusion d'adhérents n'a pas encore été implémentée. Merci de ne fusionner que des contacts non adhérents, ou bien de supprimer les adhérents manuellement en premier lieu." +#. module: golem_member +#: model:ir.model,name:golem_member.model_golem_season +msgid "GOLEM Season" +msgstr "Saison" + #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_gender msgid "Gender" @@ -618,7 +623,7 @@ msgid "Latest Invoices & Payments Matching Date" msgstr "Date de dernière correspondance des factures et paiements" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:39 +#: code:addons/golem_member/models/golem_member.py:40 #, python-format msgid "Male" msgstr "Masculin" @@ -674,7 +679,7 @@ msgstr "Numéro d'adhérent" #. module: golem_member #: model:ir.ui.menu,name:golem_member.golem_members_menu msgid "Members" -msgstr "Adhérents" +msgstr "Membres" #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_member_lines @@ -725,8 +730,8 @@ msgid "Nationality" msgstr "Nationalité" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:261 -#: code:addons/golem_member/models/golem_member.py:264 +#: code:addons/golem_member/models/golem_member.py:277 +#: code:addons/golem_member/models/golem_member.py:280 #: selection:golem.member.numberconfig,is_automatic:0 #: selection:golem.member.numberconfig,is_per_season:0 #, python-format @@ -961,7 +966,7 @@ msgstr "Numéro fiscal" #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_category_id msgid "Tags" -msgstr "Étiquettes" +msgstr "Catégories" #. module: golem_member #: model:ir.ui.view,arch_db:golem_member.golem_member_form @@ -1039,7 +1044,7 @@ msgid "This field holds the image used as avatar for this contact, limited to 10 msgstr "Ce champ contient l'image utilisée comme photo d'identité pour ce contact, limitée à 1024x1024px." #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:77 +#: code:addons/golem_member/models/golem_member.py:78 #: sql_constraint:golem.member:0 #, python-format msgid "This member number has already been used." @@ -1105,6 +1110,12 @@ msgstr "Montant total que ce client vous doit." msgid "Total amount you have to pay to this vendor." msgstr "Montant total à payer au fournisseur." +#. module: golem_member +#: code:addons/golem_member/models/golem_member.py:145 +#, python-format +msgid "Unsupported operator for defautl season search" +msgstr "Opérateur de recherche non supporté pour le filtre de saison par défaut" + #. module: golem_member #: model:ir.model.fields,help:golem_member.field_golem_member_type msgid "Used to select automatically the right address according to the context in sales and purchases documents." @@ -1136,8 +1147,8 @@ msgid "Website of Partner or Company" msgstr "Site Web pour les Partenaires ou les Sociétés" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:261 -#: code:addons/golem_member/models/golem_member.py:264 +#: code:addons/golem_member/models/golem_member.py:277 +#: code:addons/golem_member/models/golem_member.py:280 #: selection:golem.member.numberconfig,is_automatic:0 #: selection:golem.member.numberconfig,is_per_season:0 #, python-format diff --git a/golem_member/i18n/golem_member.pot b/golem_member/i18n/golem_member.pot index 559aeb1..ae57f97 100644 --- a/golem_member/i18n/golem_member.pot +++ b/golem_member/i18n/golem_member.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 06:55+0000\n" -"PO-Revision-Date: 2018-07-17 06:55+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 07:46+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -283,11 +283,6 @@ msgstr "" msgid "Current Membership Status" msgstr "" -#. module: golem_member -#: model:ir.model.fields,field_description:golem_member.field_golem_member_is_current -msgid "Current user?" -msgstr "" - #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_property_payment_term_id msgid "Customer Payment Terms" @@ -318,6 +313,11 @@ msgstr "" msgid "Default season" msgstr "" +#. module: golem_member +#: model:ir.model.fields,field_description:golem_member.field_golem_member_is_default +msgid "Default season?" +msgstr "" + #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_trust msgid "Degree of trust you have in this debtor" @@ -366,7 +366,7 @@ msgid "Fax" msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:39 +#: code:addons/golem_member/models/golem_member.py:40 #, python-format msgid "Female" msgstr "" @@ -438,11 +438,16 @@ msgid "GOLEM Members Tags" msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:318 +#: code:addons/golem_member/models/golem_member.py:334 #, python-format msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging." msgstr "" +#. module: golem_member +#: model:ir.model,name:golem_member.model_golem_season +msgid "GOLEM Season" +msgstr "" + #. module: golem_member #: model:ir.model.fields,field_description:golem_member.field_golem_member_gender msgid "Gender" @@ -612,7 +617,7 @@ msgid "Latest Invoices & Payments Matching Date" msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:39 +#: code:addons/golem_member/models/golem_member.py:40 #, python-format msgid "Male" msgstr "" @@ -719,8 +724,8 @@ msgid "Nationality" msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:261 -#: code:addons/golem_member/models/golem_member.py:264 +#: code:addons/golem_member/models/golem_member.py:277 +#: code:addons/golem_member/models/golem_member.py:280 #: selection:golem.member.numberconfig,is_automatic:0 #: selection:golem.member.numberconfig,is_per_season:0 #, python-format @@ -1031,7 +1036,7 @@ msgid "This field holds the image used as avatar for this contact, limited to 10 msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:77 +#: code:addons/golem_member/models/golem_member.py:78 #: sql_constraint:golem.member:0 #, python-format msgid "This member number has already been used." @@ -1097,6 +1102,12 @@ msgstr "" msgid "Total amount you have to pay to this vendor." msgstr "" +#. module: golem_member +#: code:addons/golem_member/models/golem_member.py:145 +#, python-format +msgid "Unsupported operator for defautl season search" +msgstr "" + #. module: golem_member #: model:ir.model.fields,help:golem_member.field_golem_member_type msgid "Used to select automatically the right address according to the context in sales and purchases documents." @@ -1128,8 +1139,8 @@ msgid "Website of Partner or Company" msgstr "" #. module: golem_member -#: code:addons/golem_member/models/golem_member.py:261 -#: code:addons/golem_member/models/golem_member.py:264 +#: code:addons/golem_member/models/golem_member.py:277 +#: code:addons/golem_member/models/golem_member.py:280 #: selection:golem.member.numberconfig,is_automatic:0 #: selection:golem.member.numberconfig,is_per_season:0 #, python-format diff --git a/golem_member/models/__init__.py b/golem_member/models/__init__.py index 8d28962..e52d006 100644 --- a/golem_member/models/__init__.py +++ b/golem_member/models/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Fabien Bourgeois +# Copyright 2016-2018 Fabien Bourgeois # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -15,4 +15,4 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from . import golem_member +from . import golem_member, golem_season diff --git a/golem_member/models/golem_member.py b/golem_member/models/golem_member.py index fbf9125..6c2faeb 100644 --- a/golem_member/models/golem_member.py +++ b/golem_member/models/golem_member.py @@ -32,6 +32,7 @@ class ResPartner(models.Model): return self.env.ref('base.main_company').country_id nationality_id = fields.Many2one('res.country', 'Nationality', + auto_join=True, default=_get_default_nationality_id) country_id = fields.Many2one(default=_get_default_nationality_id) @@ -80,7 +81,7 @@ class GolemMember(models.Model): ondelete='cascade') @api.model - def _default_season(self): + def default_season(self): """ Get default season """ domain = [('is_default', '=', True)] return self.env['golem.season'].search(domain, limit=1) @@ -97,10 +98,11 @@ class GolemMember(models.Model): help='If this field has been checked, it ' 'tells that the user refuses to receive SMS') season_ids = fields.Many2many('golem.season', string='Seasons', - required=True, default=_default_season, - ondelete='restrict') - is_current = fields.Boolean('Current user?', default=False, readonly=True, - store=True, compute='_compute_is_current') + required=True, default=default_season, + auto_join=True, ondelete='restrict') + is_default = fields.Boolean('Default season?', + compute='_compute_is_default', + search='_search_is_default') is_number_manual = fields.Boolean('Is number manual?', store=False, compute='_compute_is_number_manual') @@ -126,11 +128,23 @@ class GolemMember(models.Model): member.number_name = u' - '.join(vals) @api.depends('season_ids') - def _compute_is_current(self): + def _compute_is_default(self): """ Computes is current according to seasons """ default_s = self._default_season() for member in self: - member.is_current = default_s in member.season_ids + member.is_default = default_s in member.season_ids + + @api.multi + def _search_is_default(self, operator, value): + """ Search function for is default """ + if operator in ('in', '='): + operator = '=' if value else '!=' + elif operator in ('not in', '!='): + operator = '!=' if value else '=' + else: + err = _('Unsupported operator for defautl season search') + raise NotImplementedError(err) + return [('season_ids', operator, self.default_season().id)] @api.depends('number') def _compute_is_number_manual(self): diff --git a/golem_member/models/golem_season.py b/golem_member/models/golem_season.py new file mode 100644 index 0000000..83e9609 --- /dev/null +++ b/golem_member/models/golem_season.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +""" GOLEM Season adaptations """ + +from odoo import models, api + + +class GolemSeason(models.Model): + """ GOLEM Season adaptations """ + _inherit = 'golem.season' + + @api.multi + def do_default_season(self): + """ Add number regenration in some cases """ + self.ensure_one() + res = super(GolemSeason, self).do_default_season() + all_members = self.env['golem.member'].search([]) + conf = self.env['ir.config_parameter'] + if conf.get_param('golem_numberconfig_isautomatic') == '1' and \ + conf.get_param('golem_numberconfig_isperseason') == '1': + all_members.generate_number() + return res diff --git a/golem_member/tests/test_golem_member.py b/golem_member/tests/test_golem_member.py index d58cb81..aa4a336 100644 --- a/golem_member/tests/test_golem_member.py +++ b/golem_member/tests/test_golem_member.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2017 Fabien Bourgeois +# Copyright 2017-2018 Fabien Bourgeois # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -46,16 +46,16 @@ class GolemMemberTestCase(TransactionCase): self.assertIn('Error(s) with partner', exc_cm.exception.args[0]) self.assertEqual('No name is set.', exc_cm.exception.args[1]) - def test_current_season(self): + def test_default_season(self): """ Test if default season if fixed according to setUp and if users are correctly seen """ self.assertEqual(self.member_model._default_season(), self.season_current) - self.assertTrue(self.member1.is_current) - self.assertTrue(self.member2.is_current) + self.assertTrue(self.member1.is_default) + self.assertTrue(self.member2.is_default) self.season_next.do_default_season() - self.assertFalse(self.member1.is_current) - self.assertFalse(self.member2.is_current) + self.assertFalse(self.member1.is_default) + self.assertFalse(self.member2.is_default) def test_member_numbers_manual(self): """ Tests manual member number generation """ @@ -82,9 +82,9 @@ class GolemMemberTestCase(TransactionCase): self.member2.season_ids += self.season_next self.assertEqual(self.member2.number, u'M2') self.season_next.do_default_season() - self.assertTrue(self.member2.is_current) + self.assertTrue(self.member2.is_default) self.assertEqual(self.member2.number, u'M1') - self.assertFalse(self.member1.is_current) + self.assertFalse(self.member1.is_default) self.assertFalse(self.member1.number) def test_mnumbers_auto_season_from(self): @@ -100,9 +100,9 @@ class GolemMemberTestCase(TransactionCase): self.member2.season_ids += self.season_next self.assertEqual(self.member2.number, u'101') self.season_next.do_default_season() - self.assertTrue(self.member2.is_current) + self.assertTrue(self.member2.is_default) self.assertEqual(self.member2.number, u'100') - self.assertFalse(self.member1.is_current) + self.assertFalse(self.member1.is_default) self.assertFalse(self.member1.number) def test_member_numbers_auto_global(self): diff --git a/golem_member/views/golem_member_views.xml b/golem_member/views/golem_member_views.xml index 59ca76c..89adbff 100644 --- a/golem_member/views/golem_member_views.xml +++ b/golem_member/views/golem_member_views.xml @@ -218,7 +218,7 @@ along with this program. If not, see . + domain="[('is_default', '=', True)]" /> @@ -246,8 +246,7 @@ along with this program. If not, see . + view_mode="kanban,tree,form,graph" /> diff --git a/golem_membership/i18n/fr.po b/golem_membership/i18n/fr.po index 50130e0..f978224 100644 --- a/golem_membership/i18n/fr.po +++ b/golem_membership/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 15:27+0000\n" -"PO-Revision-Date: 2018-07-17 17:47+0200\n" +"POT-Creation-Date: 2018-07-20 07:47+0000\n" +"PO-Revision-Date: 2018-07-20 09:51+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -26,7 +26,7 @@ msgid "Cancel" msgstr "Annuler" #. module: golem_membership -#: code:addons/golem_membership/models/account_config.py:43 +#: code:addons/golem_membership/models/account_config.py:45 #, python-format msgid "Check" msgstr "Chèque" @@ -42,7 +42,7 @@ msgid "Created on" msgstr "Créé le" #. module: golem_membership -#: code:addons/golem_membership/models/account_config.py:48 +#: code:addons/golem_membership/models/account_config.py:52 #, python-format msgid "Credit Card" msgstr "Carte bancaire" diff --git a/golem_membership/i18n/golem_membership.pot b/golem_membership/i18n/golem_membership.pot index e02d5ed..6bde1bd 100644 --- a/golem_membership/i18n/golem_membership.pot +++ b/golem_membership/i18n/golem_membership.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-17 15:27+0000\n" -"PO-Revision-Date: 2018-07-17 15:27+0000\n" +"POT-Creation-Date: 2018-07-20 07:47+0000\n" +"PO-Revision-Date: 2018-07-20 07:47+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -26,7 +26,7 @@ msgid "Cancel" msgstr "" #. module: golem_membership -#: code:addons/golem_membership/models/account_config.py:43 +#: code:addons/golem_membership/models/account_config.py:45 #, python-format msgid "Check" msgstr "" @@ -42,7 +42,7 @@ msgid "Created on" msgstr "" #. module: golem_membership -#: code:addons/golem_membership/models/account_config.py:48 +#: code:addons/golem_membership/models/account_config.py:52 #, python-format msgid "Credit Card" msgstr "" diff --git a/golem_season/__manifest__.py b/golem_season/__manifest__.py index 47c72f9..2a23cac 100644 --- a/golem_season/__manifest__.py +++ b/golem_season/__manifest__.py @@ -22,7 +22,7 @@ - add season with name and period ; - choose on per default season ; - link optionnally one or many memberships types''', - 'version': '10.0.1.1.1', + 'version': '10.0.1.2.0', 'category': 'GOLEM', 'author': 'Fabien Bourgeois', 'license': 'AGPL-3', diff --git a/golem_season/i18n/fr.po b/golem_season/i18n/fr.po index 6cb9ee9..4c1071b 100644 --- a/golem_season/i18n/fr.po +++ b/golem_season/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-06 07:14+0000\n" -"PO-Revision-Date: 2018-03-06 07:14+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 09:50+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -31,7 +31,7 @@ msgid "Created on" msgstr "Créé le" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:73 +#: 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." @@ -57,7 +57,7 @@ msgid "Display Name" msgstr "Nom affiché" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:69 +#: 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." @@ -141,38 +141,39 @@ msgid "Seasons" msgstr "Saisons" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:60 +#: 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:65 +#: 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:56 +#: 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:58 +#: 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 +#: code:addons/golem_season/models/golem_season.py:29 #: sql_constraint:golem.season:0 #, python-format 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:112 +#: code:addons/golem_season/models/golem_season.py:100 #, 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 114008a..5d372e0 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-03-06 07:14+0000\n" -"PO-Revision-Date: 2018-03-06 07:14+0000\n" +"POT-Creation-Date: 2018-07-20 07:46+0000\n" +"PO-Revision-Date: 2018-07-20 07:46+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:73 +#: 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:69 +#: code:addons/golem_season/models/golem_season.py:71 #, python-format msgid "End of the period is in range of an existing period." msgstr "" @@ -141,38 +141,38 @@ msgid "Seasons" msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:60 +#: 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:65 +#: 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:56 +#: 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:58 +#: 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 +#: code:addons/golem_season/models/golem_season.py:29 #: sql_constraint:golem.season:0 #, python-format msgid "This season name has already been used." msgstr "" #. module: golem_season -#: code:addons/golem_season/models/golem_season.py:112 +#: code:addons/golem_season/models/golem_season.py:100 #, 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 d9840e0..617e9a8 100644 --- a/golem_season/models/golem_season.py +++ b/golem_season/models/golem_season.py @@ -60,7 +60,7 @@ class GolemSeason(models.Model): raise ValidationError(_('The date start is required')) if season.date_start > season.date_end: raise ValidationError(_('Start of the period cannot be ' - 'after end of the period.')) + 'after end of the period.')) seasons = self.env['golem.season'].search([]) for eachs in seasons: if eachs.date_start < season.date_start < eachs.date_end: @@ -78,23 +78,12 @@ class GolemSeason(models.Model): @api.multi def do_default_season(self): - """ is_default on and ensure that only one is_default is active. Also - recomputes is_current for members and activities. For simplicity use a - magic trick around registry rather than double inheritance """ + """ is_default on and ensure that only one is_default is active """ self.ensure_one() old_default_season = self.search([('is_default', '=', True)]) if old_default_season: old_default_season.is_default = False self.is_default = True - if 'golem.member' in self.env.registry: - all_members = self.env['golem.member'].search([]) - all_members.compute_is_current() - conf = self.env['ir.config_parameter'] - if conf.get_param('golem_numberconfig_isautomatic') == '1' and \ - conf.get_param('golem_numberconfig_isperseason') == '1': - all_members.generate_number() - if 'golem.activity' in self.env.registry: - self.env['golem.activity'].search([]).compute_is_current() @api.model def create(self, values):