forked from Yaltik/golem
[MIG][IMP]GOLEM activity registration migration to v10, and better guidelines
This commit is contained in:
parent
bccf22aa3f
commit
96822910a1
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# 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']
|
||||
}
|
||||
|
@ -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;"
|
||||
|
||||
|
@ -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 ""
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# copyright 2016 fabien bourgeois <fabien@yaltik.com>
|
||||
# copyright 2017 fabien bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" 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)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
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
|
||||
@ -15,10 +15,12 @@ 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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- Form -->
|
||||
<record id="registration_form" model="ir.ui.view">
|
||||
<record id="golem_activity_registration_form" model="ir.ui.view">
|
||||
<field name="name">Activity registration form</field>
|
||||
<field name="model">golem.activity.registration</field>
|
||||
<field name="arch" type="xml">
|
||||
@ -36,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
<!-- Tree -->
|
||||
<record id="registration_tree" model="ir.ui.view">
|
||||
<record id="golem_activity_registration_tree" model="ir.ui.view">
|
||||
<field name="name">Activity registration list</field>
|
||||
<field name="model">golem.activity.registration</field>
|
||||
<field name="arch" type="xml">
|
||||
@ -49,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</record>
|
||||
|
||||
<!-- Search -->
|
||||
<record id="searches" model="ir.ui.view">
|
||||
<record id="golem_activity_registration_search" model="ir.ui.view">
|
||||
<field name="name">GOLEM Activity Registration searches</field>
|
||||
<field name="model">golem.activity.registration</field>
|
||||
<field name="arch" type="xml">
|
||||
@ -64,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</record>
|
||||
|
||||
<!-- Action -->
|
||||
<record id="registration_action_list" model="ir.actions.act_window">
|
||||
<record id="golem_activity_registration_action" model="ir.actions.act_window">
|
||||
<field name="name">GOLEM Activity Registration List</field>
|
||||
<field name="res_model">golem.activity.registration</field>
|
||||
<field name="view_mode">tree</field>
|
||||
@ -72,9 +74,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</record>
|
||||
|
||||
<!-- Menu -->
|
||||
<menuitem id="registration_menu_list" name="Acitivity registrations"
|
||||
parent="golem_activity.activity_menu" action="registration_action_list"
|
||||
<menuitem id="golem_activity_registration_menu" name="Activity registrations"
|
||||
parent="golem_activity.golem_activity_menu"
|
||||
action="golem_activity_registration_action"
|
||||
groups="golem_base.group_golem_user"
|
||||
sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
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
|
||||
@ -15,19 +15,21 @@ 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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- Form -->
|
||||
<record id="activity_form" model="ir.ui.view">
|
||||
<record id="golem_activity_form_inherit_registration"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Activity Registrations and Places</field>
|
||||
<field name="model">golem.activity</field>
|
||||
<field name="inherit_id" ref="golem_activity.view_form" />
|
||||
<field name="inherit_id" ref="golem_activity.golem_activity_form" />
|
||||
<field name="arch" type="xml">
|
||||
<group name="places" position="inside">
|
||||
<field name="places" />
|
||||
</group>
|
||||
<page string="Session" position="after">
|
||||
<page name="session" position="after">
|
||||
<page string="Members">
|
||||
<group>
|
||||
<field name="places_remain" readonly="True" />
|
||||
@ -47,10 +49,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</record>
|
||||
|
||||
<!-- Tree -->
|
||||
<record id="activity_tree" model="ir.ui.view">
|
||||
<record id="golem_activity_tree_inherit_registration" model="ir.ui.view">
|
||||
<field name="name">Activity Tree registrations additions</field>
|
||||
<field name="model">golem.activity</field>
|
||||
<field name="inherit_id" ref="golem_activity.view_tree" />
|
||||
<field name="inherit_id" ref="golem_activity.golem_activity_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<tree position="attributes">
|
||||
<attribute name="colors">red: places_remain == 0;orange: places_remain <= 4;</attribute>
|
||||
@ -63,10 +65,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</record>
|
||||
|
||||
<!-- Search -->
|
||||
<record id="activity_search" model="ir.ui.view">
|
||||
<record id="golem_activity_search_inherit_registration" model="ir.ui.view">
|
||||
<field name="name">Activity Search registrations additions</field>
|
||||
<field name="model">golem.activity</field>
|
||||
<field name="inherit_id" ref="golem_activity.view_filter" />
|
||||
<field name="inherit_id" ref="golem_activity.golem_activity_search" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="season_default" position="after">
|
||||
<filter name="full_activity" string="Full"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
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
|
||||
@ -19,10 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<data>
|
||||
|
||||
<!-- Form -->
|
||||
<record model="ir.ui.view" id="activities_registration">
|
||||
<record id="golem_member_form_inherit_golem_activity_registration"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Add activities registrations to member form</field>
|
||||
<field name="model">golem.member</field>
|
||||
<field name="inherit_id" ref="golem_member.view_form" />
|
||||
<field name="inherit_id" ref="golem_member.golem_member_form" />
|
||||
<field name="arch" type="xml">
|
||||
<page name="other_page" position="before">
|
||||
<page name="activities" string="Activities">
|
||||
|
Loading…
Reference in New Issue
Block a user