[ADD]GOLEM Activity Registration : dynamic domain for only subscribers

* Filter members according to activity ;
* Filter activities according to member.
This commit is contained in:
Fabien BOURGEOIS 2018-09-26 10:33:17 +02:00
parent 4d889a3eba
commit 87e7bccb57
5 changed files with 56 additions and 13 deletions

View File

@ -18,7 +18,7 @@
{ {
'name': 'GOLEM Activity Member Registrations', 'name': 'GOLEM Activity Member Registrations',
'summary': 'GOLEM Activities Member Registrations management', 'summary': 'GOLEM Activities Member Registrations management',
'version': '10.0.1.4.5', 'version': '10.0.1.5.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-09 14:23+0000\n" "POT-Creation-Date: 2018-09-26 08:25+0000\n"
"PO-Revision-Date: 2018-08-09 16:38+0200\n" "PO-Revision-Date: 2018-09-26 10:28+0200\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -204,6 +204,13 @@ msgstr "Le nombre de places ne peut pas être négatif"
msgid "On default season, there is no activity for this member." msgid "On default season, there is no activity for this member."
msgstr "Sur la saison par défaut, il n'y a pas d'activité pour cet usager." msgstr "Sur la saison par défaut, il n'y a pas d'activité pour cet usager."
#. module: golem_activity_registration
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_only_for_subscriber
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_only_for_subscriber
#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_search_inherit_registration
msgid "Only for subscriber"
msgstr "Réservé aux adhérents"
#. module: golem_activity_registration #. module: golem_activity_registration
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places #: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places
msgid "Places" msgid "Places"
@ -245,7 +252,7 @@ msgid "Service user"
msgstr "Usager" msgstr "Usager"
#. module: golem_activity_registration #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:70 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:71
#, python-format #, python-format
msgid "Sorry, there is no more place !" msgid "Sorry, there is no more place !"
msgstr "Désolé, il n'y a plus de place disponible !" msgstr "Désolé, il n'y a plus de place disponible !"
@ -256,13 +263,19 @@ msgid "Subscription"
msgstr "Inscription" msgstr "Inscription"
#. module: golem_activity_registration #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:100 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:130
#, python-format
msgid "Subscription can not be executed : the targeted activity is only for subscriber."
msgstr "L'inscription n'a pas pu être faite : l'activité choisie est réservée aux adhérents."
#. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:134
#, python-format #, python-format
msgid "Subscription can not be executed : the targeted member is not on the same season as the activity." 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é." 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 #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:92 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:104
#: sql_constraint:golem.activity.registration:0 #: sql_constraint:golem.activity.registration:0
#, python-format #, python-format
msgid "This member has already been registered for this activity." msgid "This member has already been registered for this activity."

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-09 14:23+0000\n" "POT-Creation-Date: 2018-09-26 08:25+0000\n"
"PO-Revision-Date: 2018-08-09 14:23+0000\n" "PO-Revision-Date: 2018-09-26 08:25+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -204,6 +204,13 @@ msgstr ""
msgid "On default season, there is no activity for this member." msgid "On default season, there is no activity for this member."
msgstr "" msgstr ""
#. module: golem_activity_registration
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_only_for_subscriber
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_registration_only_for_subscriber
#: model:ir.ui.view,arch_db:golem_activity_registration.golem_activity_search_inherit_registration
msgid "Only for subscriber"
msgstr ""
#. module: golem_activity_registration #. module: golem_activity_registration
#: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places #: model:ir.model.fields,field_description:golem_activity_registration.field_golem_activity_places
msgid "Places" msgid "Places"
@ -245,7 +252,7 @@ msgid "Service user"
msgstr "" msgstr ""
#. module: golem_activity_registration #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:70 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:71
#, python-format #, python-format
msgid "Sorry, there is no more place !" msgid "Sorry, there is no more place !"
msgstr "" msgstr ""
@ -256,13 +263,19 @@ msgid "Subscription"
msgstr "" msgstr ""
#. module: golem_activity_registration #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:100 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:130
#, python-format
msgid "Subscription can not be executed : the targeted activity is only for subscriber."
msgstr ""
#. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:134
#, python-format #, python-format
msgid "Subscription can not be executed : the targeted member is not on the same season as the activity." msgid "Subscription can not be executed : the targeted member is not on the same season as the activity."
msgstr "" msgstr ""
#. module: golem_activity_registration #. module: golem_activity_registration
#: code:addons/golem_activity_registration/models/golem_activity_registration.py:92 #: code:addons/golem_activity_registration/models/golem_activity_registration.py:104
#: sql_constraint:golem.activity.registration:0 #: sql_constraint:golem.activity.registration:0
#, python-format #, python-format
msgid "This member has already been registered for this activity." msgid "This member has already been registered for this activity."

View File

@ -92,6 +92,23 @@ class GolemActivityRegistration(models.Model):
('registration_uniq', 'UNIQUE (member_id, activity_id)', ('registration_uniq', 'UNIQUE (member_id, activity_id)',
_('This member has already been registered for this activity.'))] _('This member has already been registered for this activity.'))]
@api.onchange('activity_id', 'activity_id.only_for_subscriber')
def onchange_activity_subcrib(self):
""" If activity only for subscribers : do not allow non subscribers """
domain = []
if self.activity_id.only_for_subscriber:
domain.append(('membership_state', 'not in', ('none', 'canceled', 'old')))
return {'domain': {'member_id': domain}}
@api.onchange('member_id')
def onchange_member_subcrib(self):
""" If not subscriber : do not show subscribers only activities """
domain = []
if self.member_id and self.member_id.membership_state in ('none', 'canceled', 'old'):
domain.append(('only_for_subscriber', '=', False))
return {'domain': {'activity_id': domain}}
@api.constrains('member_id', 'activity_id') @api.constrains('member_id', 'activity_id')
def _check_season_reliability(self): def _check_season_reliability(self):
""" Forbid registration when member season if not coherent with """ Forbid registration when member season if not coherent with

View File

@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group> </group>
</page> </page>
</page> </page>
<field name="list_price" position="after"> <field name="audience_id" position="before">
<field name="only_for_subscriber"/> <field name="only_for_subscriber"/>
</field> </field>
</field> </field>