Ajout du test d'inscription en attente à travers l'assistant

This commit is contained in:
eloyoussef 2018-03-05 12:18:37 +01:00
parent 3f3bdcdb0d
commit 0a99877589
2 changed files with 28 additions and 9 deletions

View File

@ -94,3 +94,30 @@ class TestGolemMember(TransactionCase):
self.assertEqual(activity.activity_registration_ids[0].member_id, member2) self.assertEqual(activity.activity_registration_ids[0].member_id, member2)
#verification de l'attente est vide #verification de l'attente est vide
self.assertFalse(activity.activity_queue_ids) self.assertFalse(activity.activity_queue_ids)
def test_choose_queue_to_register(self):
""" Queue register through wizard """
#création de 2 membre est une activité
member1 = self.member1.create(self.data_member_1)
member2 = self.member2.create(self.data_member_2)
activity = self.activity.create(self.data_activity)
#membre 1 inscrit sur activity
registration = {
'activity_id' : activity.id,
'member_id' : member1.id
}
#réduire le nombre de place sur activity à 1
activity.write({'places': 1})
#enregistrement du membre 1 sur activity et memebre 2 sur attente
activity.write({'activity_registration_ids': [(0, False, registration)]})
#enregistrement du membre 2 a travers l'assistant
queue_register_wizard = self.env['golem.activity.queue.choose.wizard'].create({
'activity_id': activity.id,
'member_id': member2.id
})
queue_register_wizard.register_in_queue()
#verifcation de l'inscription en queue
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
self.assertEqual(member2.activity_queue_ids[0].activity_id, activity)

View File

@ -18,7 +18,7 @@
""" GOLEM Resources management """ """ GOLEM Resources management """
from odoo import models, fields, _ from odoo import models, fields
class GolemActivityQueueChooseWizard(models.TransientModel): class GolemActivityQueueChooseWizard(models.TransientModel):
"""GOLEM Resource wizard : rchoose activity queue to register in """ """GOLEM Resource wizard : rchoose activity queue to register in """
@ -35,11 +35,3 @@ class GolemActivityQueueChooseWizard(models.TransientModel):
activity_queue = self[0] activity_queue = self[0]
self.env['golem.activity.queue'].create({'member_id': activity_queue.member_id.id, self.env['golem.activity.queue'].create({'member_id': activity_queue.member_id.id,
'activity_id': activity_queue.activity_id.id}) 'activity_id': activity_queue.activity_id.id})
message = _('the member {} is registred in queue for the activity {} with success')
return {
'warning' : {
'title' : _('Warning'),
'message': (message.format(activity_queue.member_id.name,
activity_queue.activity_id.name))
}
}