[REF]GOLEM Activity Queue : check if registration is already done can be made from member directly
This commit is contained in:
parent
80ef3f26a6
commit
c3b21987c9
@ -44,15 +44,11 @@ class GolemActivityQueue(models.Model):
|
|||||||
sequence = fields.Integer()
|
sequence = fields.Integer()
|
||||||
|
|
||||||
@api.constrains('member_id', 'activity_id')
|
@api.constrains('member_id', 'activity_id')
|
||||||
def _check_member_registration(self):
|
def check_member_registration(self):
|
||||||
""" Forbid registration in queue when member is already registred in the
|
""" Forbid registration in queue when member is already registred in the
|
||||||
activity """
|
activity """
|
||||||
for queue in self:
|
for queue in self:
|
||||||
domain = [('member_id', '=', queue.member_id.id),
|
if queue.activity_id in \
|
||||||
('activity_id', '=', queue.activity_id.id)]
|
queue.member_id.activity_registration_all_ids.mapped('activity_id'):
|
||||||
#verifier si un enrigistrement avec le meme membre et activité est déja fait
|
|
||||||
registrations = self.env['golem.activity.registration'].search(domain)
|
|
||||||
#si oui lancer un erreur
|
|
||||||
if len(registrations):
|
|
||||||
raise ValidationError(_('The member your trying to add to the queue'
|
raise ValidationError(_('The member your trying to add to the queue'
|
||||||
' is already registred for this activity'))
|
' is already registred for this activity'))
|
||||||
|
Loading…
Reference in New Issue
Block a user