diff --git a/golem_activity_registration/__manifest__.py b/golem_activity_registration/__manifest__.py index f3b9245..074d70b 100644 --- a/golem_activity_registration/__manifest__.py +++ b/golem_activity_registration/__manifest__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Fabien Bourgeois +# 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 @@ -23,9 +23,9 @@ 'author': 'Fabien Bourgeois', 'license': 'AGPL-3', 'application': False, - 'installable': False, + 'installable': True, 'depends': ['golem_activity', 'golem_member'], - 'data': ['views/golem_activity_registration_view.xml', - 'views/golem_member_view.xml', 'views/golem_activity_view.xml', + 'data': ['views/golem_activity_registration_views.xml', + 'views/golem_member_views.xml', 'views/golem_activity_views.xml', 'security/ir.model.access.csv'] } diff --git a/golem_activity_registration/i18n/fr.po b/golem_activity_registration/i18n/fr.po index aa3acfc..a2d70c9 100644 --- a/golem_activity_registration/i18n/fr.po +++ b/golem_activity_registration/i18n/fr.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-10-10 16:10+0000\n" -"PO-Revision-Date: 2016-10-10 16:10+0000\n" +"POT-Creation-Date: 2017-05-01 21:16+0000\n" +"PO-Revision-Date: 2017-05-01 21:16+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,53 +17,53 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: golem_activity_registration -#: model:ir.ui.menu,name:golem_activity_registration.registration_menu_list -msgid "Acitivity registrations" -msgstr "Inscriptions aux activités" - -#. module: golem_activity_registration -#: view:golem.member:golem_activity_registration.activities_registration -#: field:golem.member,activity_registration_ids:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_form_inherit_golem_activity_registration msgid "Activities" msgstr "Activités" #. module: golem_activity_registration -#: field:golem.activity.registration,activity_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_activity_id msgid "Activity" msgstr "Activité" #. module: golem_activity_registration -#: field:golem.activity.registration,create_uid:0 -msgid "Created by" -msgstr "Creé par" +#: model:ir.ui.menu,name:golem_activity_registration.golem_activity_registration_menu +msgid "Activity registrations" +msgstr "Inscriptions" #. module: golem_activity_registration -#: field:golem.activity.registration,create_date:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: golem_activity_registration +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_create_date msgid "Created on" msgstr "Créé le" #. module: golem_activity_registration -#: field:golem.activity.registration,is_current:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_is_current msgid "Current season?" -msgstr "Saison par défaut?" +msgstr "Saison en cours?" #. module: golem_activity_registration -#: view:golem.activity.registration:golem_activity_registration.searches +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_registration_search msgid "Default season" msgstr "Saison par défaut" #. module: golem_activity_registration -#: view:golem.member:golem_activity_registration.activities_registration +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_form_inherit_golem_activity_registration msgid "Default season activities" msgstr "Activités de la saison affichée par défaut" #. module: golem_activity_registration -#: field:golem.activity.registration,display_name:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_display_name msgid "Display Name" msgstr "Nom affiché" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_search +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_search_inherit_registration msgid "Full" msgstr "Plein" @@ -78,7 +78,7 @@ msgid "GOLEM Activity Registration" msgstr "Inscription à l'activité" #. module: golem_activity_registration -#: model:ir.actions.act_window,name:golem_activity_registration.registration_action_list +#: model:ir.actions.act_window,name:golem_activity_registration.golem_activity_registration_action msgid "GOLEM Activity Registration List" msgstr "Liste des inscriptions aux activités" @@ -88,99 +88,88 @@ msgid "GOLEM Member" msgstr "Adhérent" #. module: golem_activity_registration -#: field:golem.activity.registration,id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_id msgid "ID" msgstr "ID" #. module: golem_activity_registration -#: field:golem.activity.registration,__last_update:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration___last_update msgid "Last Modified on" -msgstr "Modifié pour la dernière fois le" +msgstr "Dernière Modification le" #. module: golem_activity_registration -#: field:golem.activity.registration,write_uid:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_write_uid msgid "Last Updated by" msgstr "Dernière mise à jour par" #. module: golem_activity_registration -#: field:golem.activity.registration,write_date:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_write_date msgid "Last Updated on" -msgstr "Mis à jour pour la dernière fois le" +msgstr "Dernière mise à jour le" #. module: golem_activity_registration -#: field:golem.activity.registration,member_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_member_id msgid "Member" msgstr "Adhérent" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_form -#: field:golem.activity,activity_registration_ids:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_activity_registration_ids +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_form_inherit_registration msgid "Members" msgstr "Adhérents" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:32 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:36 #: sql_constraint:golem.activity:0 #, python-format msgid "Number of places cannot be negative." msgstr "Le nombre de places ne peut pas être négatif" #. module: golem_activity_registration -#: field:golem.activity,places:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places msgid "Places" msgstr "Places" #. module: golem_activity_registration -#: field:golem.activity,places_used:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places_used msgid "Places used" msgstr "Places prises" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_tree +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_tree_inherit_registration msgid "Remain" msgstr "Reste" #. module: golem_activity_registration -#: field:golem.activity,places_remain:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places_remain msgid "Remaining places" msgstr "Places restantes" #. module: golem_activity_registration -#: field:golem.activity.registration,season_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_season_id msgid "Season" msgstr "Saison" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_form -msgid "Session" -msgstr "Séance" - -#. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:58 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:67 #, python-format msgid "Sorry, there is no more place !" msgstr "Désolé, il n'y a plus de place disponible !" #. module: golem_activity_registration -#: view:golem.activity.registration:golem_activity_registration.registration_form +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_registration_form msgid "Subscription" msgstr "Inscription" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:85 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:95 #, 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 : le membre 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:77 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:87 #: sql_constraint:golem.activity.registration:0 #, python-format msgid "This member has already been registered for this activity." msgstr "Le membre a déjà été inscrit à cette activité." - -#. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_tree -msgid "red: places_remain == 0;orange: places_remain <= 4;" -msgstr "red: places_remain == 0;orange: places_remain <= 4;" - diff --git a/golem_activity_registration/i18n/golem_activity_registration.pot b/golem_activity_registration/i18n/golem_activity_registration.pot index c049128..addbfac 100644 --- a/golem_activity_registration/i18n/golem_activity_registration.pot +++ b/golem_activity_registration/i18n/golem_activity_registration.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-10-10 16:10+0000\n" -"PO-Revision-Date: 2016-10-10 16:10+0000\n" +"POT-Creation-Date: 2017-05-01 21:16+0000\n" +"PO-Revision-Date: 2017-05-01 21:16+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,53 +16,53 @@ msgstr "" "Plural-Forms: \n" #. module: golem_activity_registration -#: model:ir.ui.menu,name:golem_activity_registration.registration_menu_list -msgid "Acitivity registrations" -msgstr "" - -#. module: golem_activity_registration -#: view:golem.member:golem_activity_registration.activities_registration -#: field:golem.member,activity_registration_ids:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_member_activity_registration_ids +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_form_inherit_golem_activity_registration msgid "Activities" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,activity_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_activity_id msgid "Activity" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,create_uid:0 +#: model:ir.ui.menu,name:golem_activity_registration.golem_activity_registration_menu +msgid "Activity registrations" +msgstr "" + +#. module: golem_activity_registration +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_create_uid msgid "Created by" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,create_date:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_create_date msgid "Created on" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,is_current:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_is_current msgid "Current season?" msgstr "" #. module: golem_activity_registration -#: view:golem.activity.registration:golem_activity_registration.searches +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_registration_search msgid "Default season" msgstr "" #. module: golem_activity_registration -#: view:golem.member:golem_activity_registration.activities_registration +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_member_form_inherit_golem_activity_registration msgid "Default season activities" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,display_name:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_display_name msgid "Display Name" msgstr "" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_search +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_search_inherit_registration msgid "Full" msgstr "" @@ -77,7 +77,7 @@ msgid "GOLEM Activity Registration" msgstr "" #. module: golem_activity_registration -#: model:ir.actions.act_window,name:golem_activity_registration.registration_action_list +#: model:ir.actions.act_window,name:golem_activity_registration.golem_activity_registration_action msgid "GOLEM Activity Registration List" msgstr "" @@ -87,103 +87,89 @@ msgid "GOLEM Member" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_id msgid "ID" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,__last_update:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration___last_update msgid "Last Modified on" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,write_uid:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_write_uid msgid "Last Updated by" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,write_date:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_write_date msgid "Last Updated on" msgstr "" #. module: golem_activity_registration -#: sql_constraint:golem.activity:0 -msgid "Le nombre de places ne peut pas être négatif" -msgstr "" - -#. module: golem_activity_registration -#: field:golem.activity.registration,member_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_member_id msgid "Member" msgstr "" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_form -#: field:golem.activity,activity_registration_ids:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_activity_registration_ids +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_form_inherit_registration msgid "Members" msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:32 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:36 +#: sql_constraint:golem.activity:0 #, python-format msgid "Number of places cannot be negative." msgstr "" #. module: golem_activity_registration -#: field:golem.activity,places:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places msgid "Places" msgstr "" #. module: golem_activity_registration -#: field:golem.activity,places_used:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places_used msgid "Places used" msgstr "" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_tree +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_tree_inherit_registration msgid "Remain" msgstr "" #. module: golem_activity_registration -#: field:golem.activity,places_remain:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places_remain msgid "Remaining places" msgstr "" #. module: golem_activity_registration -#: field:golem.activity.registration,season_id:0 +#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_season_id msgid "Season" msgstr "" #. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_form -msgid "Session" -msgstr "" - -#. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:58 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:67 #, python-format msgid "Sorry, there is no more place !" msgstr "" #. module: golem_activity_registration -#: view:golem.activity.registration:golem_activity_registration.registration_form +#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_registration_form msgid "Subscription" msgstr "" #. module: golem_activity_registration -#: code:addons/golem_activity_registration/models/golem_activity_registration.py:85 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:95 #, 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:77 +#: code:addons/golem_activity_registration/models/golem_activity_registration.py:87 #: sql_constraint:golem.activity.registration:0 #, python-format msgid "This member has already been registered for this activity." msgstr "" -#. module: golem_activity_registration -#: view:golem.activity:golem_activity_registration.activity_tree -msgid "red: places_remain == 0;orange: places_remain <= 4;" -msgstr "" - diff --git a/golem_activity_registration/models/golem_activity_registration.py b/golem_activity_registration/models/golem_activity_registration.py index 0863090..1b6a788 100644 --- a/golem_activity_registration/models/golem_activity_registration.py +++ b/golem_activity_registration/models/golem_activity_registration.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# copyright 2016 fabien bourgeois +# 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 @@ -15,57 +15,67 @@ # you should have received a copy of the gnu affero general public license # along with this program. if not, see . +""" GOLEM Activity Registration """ + from odoo import models, fields, api, _ - class GolemMember(models.Model): + """ GOLEM Member adaptations """ _inherit = 'golem.member' activity_registration_ids = fields.One2many('golem.activity.registration', - 'member_id', 'Activities') + 'member_id', 'Activities', + index=True) class GolemActivity(models.Model): + """ GOLEM Activity adaptations """ _inherit = 'golem.activity' _sql_constraints = [('golem_activity_places_signed', 'CHECK (places >= 0)', _('Number of places cannot be negative.'))] activity_registration_ids = fields.One2many('golem.activity.registration', - 'activity_id', 'Members') + 'activity_id', 'Members', + index=True) places_used = fields.Integer('Places used', compute='_compute_places_used', store=True) - @api.one + @api.multi @api.depends('activity_registration_ids') def _compute_places_used(self): - self.places_used = len(self.activity_registration_ids) + """ Computes used places """ + for activity in self: + activity.places_used = len(activity.activity_registration_ids) places = fields.Integer('Places', default=20) places_remain = fields.Integer('Remaining places', store=True, compute='_compute_places_remain') - @api.one + @api.multi @api.depends('places', 'places_used') def _compute_places_remain(self): - self.places_remain = self.places - self.places_used + """ Computes remaining places """ + for activity in self: + activity.places_remain = activity.places - activity.places_used @api.constrains('places_remain') def _check_remaining_places(self): """ Forbid inscription when there is no more place """ - for s in self: - if s.places_remain < 0: + for activity in self: + if activity.places_remain < 0: emsg = _('Sorry, there is no more place !') raise models.ValidationError(emsg) class GolemActivityRegistration(models.Model): + """ GOLEM Activity Registration """ _name = 'golem.activity.registration' _description = 'GOLEM Activity Registration' member_id = fields.Many2one('golem.member', string='Member', required=True, - ondelete='cascade') - activity_id = fields.Many2one('golem.activity', required=True, + ondelete='cascade', index=True) + activity_id = fields.Many2one('golem.activity', required=True, index=True, string='Activity', ondelete='cascade') season_id = fields.Many2one(string='Season', related='activity_id.season_id') @@ -80,8 +90,8 @@ class GolemActivityRegistration(models.Model): def _check_season_reliability(self): """ Forbid registration when member season if not coherent with activity season or are duplicates """ - for r in self: - if r.activity_id.season_id not in r.member_id.season_ids: + for reg in self: + if reg.activity_id.season_id not in reg.member_id.season_ids: emsg = _('Subscription can not be executed : the targeted ' 'member is not on the same season as the activity.') raise models.ValidationError(emsg) diff --git a/golem_activity_registration/views/golem_activity_registration_views.xml b/golem_activity_registration/views/golem_activity_registration_views.xml index 3962a62..03b52d3 100644 --- a/golem_activity_registration/views/golem_activity_registration_views.xml +++ b/golem_activity_registration/views/golem_activity_registration_views.xml @@ -1,6 +1,6 @@ + + - + Activity registration form golem.activity.registration @@ -36,7 +38,7 @@ along with this program. If not, see . - + Activity registration list golem.activity.registration @@ -49,7 +51,7 @@ along with this program. If not, see . - + GOLEM Activity Registration searches golem.activity.registration @@ -64,7 +66,7 @@ along with this program. If not, see . - + GOLEM Activity Registration List golem.activity.registration tree @@ -72,9 +74,11 @@ along with this program. If not, see . - + diff --git a/golem_activity_registration/views/golem_activity_views.xml b/golem_activity_registration/views/golem_activity_views.xml index 16a1102..6f43216 100644 --- a/golem_activity_registration/views/golem_activity_views.xml +++ b/golem_activity_registration/views/golem_activity_views.xml @@ -1,6 +1,6 @@ + - + Activity Registrations and Places golem.activity - + - + @@ -47,10 +49,10 @@ along with this program. If not, see . - + Activity Tree registrations additions golem.activity - + red: places_remain == 0;orange: places_remain <= 4; @@ -63,10 +65,10 @@ along with this program. If not, see . - + Activity Search registrations additions golem.activity - + - + Add activities registrations to member form golem.member - +