Add wizard to ask member about activity to register

This commit is contained in:
eloyoussef 2018-02-20 19:11:15 +01:00
parent 76315c1d15
commit f77a93a1a2
7 changed files with 110 additions and 7 deletions

View File

@ -15,4 +15,4 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import models from . import models, wizard

View File

@ -28,6 +28,7 @@
'data': [ 'data': [
'views/golem_activity_queue_views.xml', 'views/golem_activity_queue_views.xml',
'views/golem_activity_views.xml', 'views/golem_activity_views.xml',
'views/golem_member_views.xml' 'views/golem_member_views.xml',
'wizard/golem_activity_queue_choose_views.xml'
] ]
} }

View File

@ -24,6 +24,7 @@ class GolemMember(models.Model):
@api.onchange('activity_registration_ids') @api.onchange('activity_registration_ids')
def _checkRemain(self): def _checkRemain(self):
if len(self.activity_registration_ids) > self.places and self.queue_allowed: if len(self.activity_registration_ids) > self.places and self.queue_allowed:
return { return {
'warning' : { 'warning' : {
@ -33,11 +34,11 @@ class GolemMember(models.Model):
} }
def queue_register(self): def queue_register(self):
return { return {
'name' : _('Register in the queue'), 'name' : _('Choose the activity to register in'),
'type' : 'ir.actions.act_window', 'type' : 'ir.actions.act_window',
'res_model' : 'golem.activity.queue', 'res_model' : 'golem.activity.queue.choose.wizard',
'view_mode': 'tree', 'view_mode': 'form',#'context' :{'default_activity_id' : activity_id.id},'domain' : [('activity_id.places_remain', '=', 0)],# activity_id.name)],#"('activity_id', '=', True)"'flags': {'action_buttons': True},
'flags': {'action_buttons': True},
'target': 'new', 'target': 'new',
} }

View File

@ -47,7 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="member_id"/> <field name="member_id"/>
<field name="activity_id" readonly='1'/> <field name="activity_id" readonly='1'/>
<field name="season_id" readonly='1'/> <field name="season_id" readonly='1'/>
<field name='test'/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 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 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 <http://www.gnu.org/licenses/>.
from . import golem_activity_queue_choose

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 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 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 <http://www.gnu.org/licenses/>.
""" GOLEM Resources management """
from odoo import models, fields, api, _
class GolemActivityQueueChooseWizard(models.TransientModel):
"""GOLEM Resource wizard : rchoose activity queue to register in """
_name = "golem.activity.queue.choose.wizard"
activity_id = fields.Many2one("golem.activity")
def ChooseActivity(self):
self.ensure_one()
activityQueue = self[0]
return {
'name' : _('Register in the queue'),
'type' : 'ir.actions.act_window',
'res_model' : 'golem.activity.queue',
'view_mode': 'tree',#'context' :{'default_activity_id' : activity_id.id},
'domain' : [('activity_id', '=',activityQueue.activity_id.id )],# activity_id.name)],#"('activity_id', '=', True)"
'flags': {'action_buttons': True},
'target': 'new',
}

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
Copyright 2018 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
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 <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_activity_queue_choose_wizard_view_form">
<field name="name">GOLEM Activity Queue Choose Wizard Form</field>
<field name="model">golem.activity.queue.choose.wizard</field>
<field name="arch" type="xml">
<form string="Rejection reason">
<group>
<field name="activity_id"/>
</group>
<footer>
<button name="ChooseActivity" string="Choose Activity to register in" type="object"
class="oe_highlight" />
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
</data>
</odoo>