add queue register function to member model

This commit is contained in:
eloyoussef 2018-02-20 13:01:04 +01:00
parent 78687127f0
commit 321b25661a
3 changed files with 14 additions and 4 deletions

View File

@ -33,13 +33,13 @@ class GolemActivity(models.Model):
'name' : _('Register in the queue'), 'name' : _('Register in the queue'),
'type' : 'ir.actions.act_window', 'type' : 'ir.actions.act_window',
'res_model' : 'golem.activity.queue', 'res_model' : 'golem.activity.queue',
'view_mode': 'form', 'view_mode': 'tree,form',
'view_type': 'form', 'flags': {'action_buttons': True},
'target': 'new', 'target': 'new',
} }
@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' : {

View File

@ -31,3 +31,13 @@ class GolemMember(models.Model):
'message': _('No remaining place, please register in the queue'), 'message': _('No remaining place, please register in the queue'),
} }
} }
def queue_register(self):
return {
'name' : _('Register in the queue'),
'type' : 'ir.actions.act_window',
'res_model' : 'golem.activity.queue',
'view_mode': 'tree',
'flags': {'action_buttons': True},
'target': 'new',
}

View File

@ -43,7 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="name">queue.tree</field> <field name="name">queue.tree</field>
<field name="model">golem.activity.queue</field> <field name="model">golem.activity.queue</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Queue Tree" editable="top"> <tree string="Queue Tree" editable="bottom">
<field name="activity_id"/> <field name="activity_id"/>
<field name="season_id"/> <field name="season_id"/>
<field name="member_id"/> <field name="member_id"/>