forked from Yaltik/golem
Amélioration du fonction de basculement automatique depuis membre : utilisation vals
This commit is contained in:
parent
3ab701c8d4
commit
e4596cbda0
@ -30,14 +30,15 @@ class GolemActivity(models.Model):
|
||||
# un booleen pour determiner si une fille d'attente est autorisé
|
||||
queue_allowed = fields.Boolean(default=True, readonly=True)
|
||||
# un booleen pour automatisé l'inscription sur une activité depuis la file d'attente
|
||||
automated_registration_from_queue = fields.Boolean(default=True, readonly=True)
|
||||
auto_registration_from_queue = fields.Boolean(default=True, readonly=True)
|
||||
#ajout d'un champs pour calculer le nombre d'inscription en file d'attente
|
||||
queue_activity_number = fields.Integer(compute="_queue_activity_number",
|
||||
queue_activity_number = fields.Integer(compute="_compute_queue_activity_number",
|
||||
store=True, string='Pending registration number')
|
||||
@api.multi
|
||||
def automated_registration_from_queue_toggle(self):
|
||||
def auto_registration_from_queue_toggle(self):
|
||||
""" switch registration from queueu mode """
|
||||
for activity in self:
|
||||
activity.automated_registration_from_queue = not activity.automated_registration_from_queue
|
||||
activity.auto_registration_from_queue = not activity.auto_registration_from_queue
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
@ -65,7 +66,7 @@ class GolemActivity(models.Model):
|
||||
|
||||
#mettre à jour le status d'activité remplis sur chaque attente
|
||||
@api.constrains('places_remain')
|
||||
def updateActivityState(self):
|
||||
def update_activity_fullness(self):
|
||||
"""updates queue.is_activity_full based on places_remain"""
|
||||
for activity in self:
|
||||
for queue in self.activity_queue_ids:
|
||||
@ -87,7 +88,7 @@ class GolemActivity(models.Model):
|
||||
activity.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#changer l'état de queue allowed et automated_registration en false
|
||||
activity.queue_allowed = False
|
||||
activity.automated_registration_from_queue = False
|
||||
activity.auto_registration_from_queue = False
|
||||
|
||||
else:
|
||||
#lancer popup pour choisir activité à s'inscrire
|
||||
@ -105,7 +106,8 @@ class GolemActivity(models.Model):
|
||||
|
||||
|
||||
|
||||
#contraint sur nombre d'inscription : une desincription declanche une inscription depuis attente
|
||||
#contraint sur nombre d'inscription : une desincription declanche une inscription
|
||||
#depuis attente mode automatique
|
||||
@api.multi
|
||||
@api.constrains('activity_registration_ids')
|
||||
def _automatedRegistrationFromQueue(self):
|
||||
@ -118,7 +120,7 @@ class GolemActivity(models.Model):
|
||||
if (len(record.activity_registration_ids) < record.places and
|
||||
record.queue_activity_number > 0 and
|
||||
record.queue_allowed and
|
||||
record.automated_registration_from_queue):
|
||||
record.auto_registration_from_queue):
|
||||
#recupérer la liste en file d'attente
|
||||
queues = record.activity_queue_ids
|
||||
#trier la liste selon l'id : récupérer l'ancien element
|
||||
@ -131,13 +133,15 @@ class GolemActivity(models.Model):
|
||||
membre_registred = False
|
||||
#recuperer la liste des registration
|
||||
registrations = record.activity_registration_ids
|
||||
#parcourir les registration afin de vérifier si le memebre sur l'attente déja inscrit
|
||||
#parcourir les registration afin de vérifier si le memebre sur l'attente
|
||||
#déja inscrit
|
||||
for registration in registrations:
|
||||
#compare le membre sur l'attente au membre sur l'inscription
|
||||
if queue.member_id == registration.member_id:
|
||||
#si membre trouvé inscrit sur l'activité on le supprime de la queue
|
||||
record.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#si membre trouvé on mentionne enregistré, on passe au registration suivante
|
||||
#si membre trouvé on mentionne enregistré, on passe au
|
||||
#registration suivante
|
||||
membre_registred = True
|
||||
break
|
||||
#à la sortie de la boucle si le membre nest pas sur inscription faire une
|
||||
@ -159,13 +163,15 @@ class GolemActivity(models.Model):
|
||||
#calculer le nombre d'inscription sur la file d'attente
|
||||
@api.multi
|
||||
@api.depends('activity_queue_ids')
|
||||
def _queue_activity_number(self):
|
||||
def _compute_queue_activity_number(self):
|
||||
""" compute number of queue registration for activity"""
|
||||
for activity in self:
|
||||
activity.queue_activity_number = len(activity.activity_queue_ids)
|
||||
|
||||
#lancer une fenetre pour inscritpion en file d'attente à partir du boutton
|
||||
@api.multi
|
||||
def queue_register(self):
|
||||
""" launch a wizard to register in queue """
|
||||
self.ensure_one()
|
||||
activity_id = self[0]
|
||||
return {
|
||||
@ -173,7 +179,7 @@ class GolemActivity(models.Model):
|
||||
'type' : 'ir.actions.act_window',
|
||||
'res_model' : 'golem.activity.queue',
|
||||
'context' :{'default_activity_id' : activity_id.id},
|
||||
'domain' : [('activity_id', '=', activity_id.id)],# activity_id.name)],#"('activity_id', '=', True)"
|
||||
'domain' : [('activity_id', '=', activity_id.id)],
|
||||
'view_mode': 'tree',
|
||||
'flags': {'action_buttons': True},
|
||||
'target': 'new',
|
||||
@ -182,6 +188,7 @@ class GolemActivity(models.Model):
|
||||
#fonction enregistrement du premier element de la liste d'ttente en inscription : mode manuel
|
||||
@api.multi
|
||||
def register_from_queue(self):
|
||||
""" register member from queue"""
|
||||
for record in self:
|
||||
#recupérer la liste en file d'attente
|
||||
queues = record.activity_queue_ids
|
||||
@ -195,7 +202,8 @@ class GolemActivity(models.Model):
|
||||
membre_registred = False
|
||||
#recuperer la liste des registration
|
||||
registrations = record.activity_registration_ids
|
||||
#parcourir les registration afin de vérifier si le memebre sur l'attente déja inscrit
|
||||
#parcourir les registration afin de vérifier si le memebre sur
|
||||
#l'attente déja inscrit
|
||||
for registration in registrations:
|
||||
#compare le membre sur l'attente au membre sur l'inscription
|
||||
if queue.member_id == registration.member_id:
|
||||
@ -203,7 +211,8 @@ class GolemActivity(models.Model):
|
||||
record.activity_queue_ids = [(2, queue.id, 0)]
|
||||
# on mentionne enregistré, on passe au registration suivante
|
||||
membre_registred = True
|
||||
#on sort de la boucle de registration et on passe à l'element suivant de l'attente
|
||||
#on sort de la boucle de registration et on passe à
|
||||
#l'element suivant de l'attente
|
||||
break
|
||||
#à la sortie de la boucle si le membre nest pas sur inscription faire une
|
||||
if not membre_registred:
|
||||
@ -227,7 +236,7 @@ class GolemActivity(models.Model):
|
||||
#2 verifier si desincription donc place disponible pour queue(automatique ou manuel)
|
||||
@api.multi
|
||||
@api.onchange('activity_registration_ids')
|
||||
def _checkRegistrationNumber(self):
|
||||
def _check_registration_number(self):
|
||||
current_activity = self._origin
|
||||
for record in self:
|
||||
#warning au cas ou le nombre d'inscription depasse le nombre de place
|
||||
@ -246,27 +255,28 @@ class GolemActivity(models.Model):
|
||||
len(current_activity.activity_registration_ids) == record.places and
|
||||
record.queue_activity_number > 0):
|
||||
#si le mode d'inscription depuis attente est activé
|
||||
if record.automated_registration_from_queue:
|
||||
#lancer un warning informant que l'inscription automatique aura lieu apres sauvegarde
|
||||
print("________________________testuii____________________________________")
|
||||
warningMessage = _('There is a free place for the activity'
|
||||
if record.auto_registration_from_queue:
|
||||
#lancer un warning informant que l'inscription automatique aura
|
||||
#lieu apres sauvegarde
|
||||
warning_message = _('There is a free place for the activity'
|
||||
' : {}, once you save it will be filled'
|
||||
' by the first membre from queue')
|
||||
return {
|
||||
'warning' : {
|
||||
'title' : _('Warning'),
|
||||
'message': warningMessage.format(record.name)
|
||||
'message': warning_message.format(record.name)
|
||||
}
|
||||
}
|
||||
|
||||
#traitement manuel pour le passage de la file d'attente en inscription : button sur queue
|
||||
#traitement manuel pour le passage de la file d'attente en inscription
|
||||
# : button sur queue
|
||||
else:
|
||||
warningMessage = _('There is a free place for the activity'
|
||||
warning_message = _('There is a free place for the activity'
|
||||
' : {}, you can fill it from the queue'
|
||||
' using the button on queue tab')
|
||||
return {
|
||||
'warning' : {
|
||||
'title' : _('Warning'),
|
||||
'message': warningMessage.format(record.name)
|
||||
'message': warning_message.format(record.name)
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class GolemActivityQueue(models.Model):
|
||||
#nombre de place disponible sur activité liée
|
||||
places_remain = fields.Integer(related='activity_id.places_remain')
|
||||
#activité liée est plein ou non
|
||||
is_activity_full = fields.Char(compute="_isActivityFull", store=True)
|
||||
is_activity_full = fields.Char(compute="_compute_is_activity_full", store=True)
|
||||
|
||||
sequence = fields.Integer()
|
||||
|
||||
@ -51,7 +51,7 @@ class GolemActivityQueue(models.Model):
|
||||
|
||||
# decider si l'activity liée est pleine ou non : pour group by sur la liste
|
||||
@api.depends('places_remain')
|
||||
def _isActivityFull(self):
|
||||
def _compute_is_activity_full(self):
|
||||
""" Decide if activity is full or not """
|
||||
for record in self:
|
||||
if record.places_remain == 0:
|
||||
|
@ -27,23 +27,18 @@ class GolemMember(models.Model):
|
||||
'member_id', 'Pending registration')
|
||||
|
||||
@api.multi
|
||||
def write(self, values):
|
||||
|
||||
#comparer old with new
|
||||
oldRegistrations = self.activity_registration_ids
|
||||
oldActivities = [oldRegistration.activity_id.id for oldRegistration in oldRegistrations]
|
||||
|
||||
super(GolemMember, self).write(values)
|
||||
newRegistrations = self.activity_registration_ids
|
||||
if len(oldRegistrations) > len(newRegistrations):
|
||||
newActivities = [newRegistration.activity_id.id for newRegistration in newRegistrations]
|
||||
changed = list(set(oldActivities) - set(newActivities))
|
||||
activityRemoved = self.env['golem.activity'].browse(changed[0])
|
||||
|
||||
if (activityRemoved.queue_allowed and
|
||||
activityRemoved.automated_registration_from_queue and
|
||||
activityRemoved.queue_activity_number > 0):
|
||||
queues = activityRemoved.activity_queue_ids
|
||||
def write(self, vals):
|
||||
registrations_edited = vals.get('activity_registration_ids')
|
||||
if registrations_edited:
|
||||
for registration_edited in registrations_edited:
|
||||
if registration_edited[0] == 2:
|
||||
registration_removed = self.env['golem.activity.registration'].browse(registration_edited[1])
|
||||
activity_removed = self.env['golem.activity'].browse(registration_removed.activity_id.id)
|
||||
if (activity_removed.queue_allowed and
|
||||
activity_removed.auto_registration_from_queue and
|
||||
activity_removed.queue_activity_number > 0):
|
||||
#récupérer la liste des attente lié à l'activité
|
||||
queues = activity_removed.activity_queue_ids
|
||||
#trier la liste selon l'id : récupérer l'ancien element
|
||||
queues_sorted = sorted(queues, key=lambda k: k['id'])
|
||||
#suppose que le membre est enrigistré
|
||||
@ -53,64 +48,62 @@ class GolemMember(models.Model):
|
||||
#inverse l'etat du memebre
|
||||
membre_registred = False
|
||||
#recuperer la liste des registration
|
||||
registrations = activityRemoved.activity_registration_ids
|
||||
#parcourir les registration afin de vérifier si le memebre sur l'attente déja inscrit
|
||||
registrations = activity_removed.activity_registration_ids
|
||||
#parcourir les registration afin de vérifier si le memebre sur
|
||||
#l'attente déja inscrit
|
||||
for registration in registrations:
|
||||
#compare le membre sur l'attente au membre sur l'inscription
|
||||
if queue.member_id == registration.member_id:
|
||||
#si membre trouvé inscrit sur l'activité on le supprime de la queue
|
||||
record.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#si membre trouvé on mentionne enregistré, on passe au registration suivante
|
||||
#si membre trouvé inscrit sur l'activité on le
|
||||
#supprime de la queue
|
||||
activity_removed.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#si membre trouvé on mentionne enregistré, on passe au
|
||||
#registration suivante
|
||||
membre_registred = True
|
||||
break
|
||||
#à la sortie de la boucle si le membre nest pas sur inscription faire une
|
||||
#à la sortie de la boucle si le membre nest pas sur
|
||||
#inscription faire une
|
||||
if not membre_registred:
|
||||
#valeures pour creer une inscritpion apartir de la file
|
||||
values = {
|
||||
'activity_id' : queue.activity_id,
|
||||
'member_id' : queue.member_id
|
||||
}
|
||||
# creation d'inscription
|
||||
activityRemoved.activity_registration_ids = [(0, 0,values)]
|
||||
#suppression de l'element de la file d'attente
|
||||
activityRemoved.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#sortir de la boucle parcourissante la queue puisque inscription faite
|
||||
break
|
||||
|
||||
warningMessage = _('There is a free place for the activity'
|
||||
super(GolemMember, self).write(vals)
|
||||
# creation d'inscription
|
||||
activity_removed.activity_registration_ids = [(0, 0, values)]
|
||||
#suppression de l'element de la file d'attente
|
||||
activity_removed.activity_queue_ids = [(2, queue.id, 0)]
|
||||
#afficher un message informatif
|
||||
warning_message = _('There is a free place for the activity'
|
||||
' : {}, once you save it will be filled'
|
||||
' by the first membre from queue')
|
||||
print warningMessage.format(activityRemoved.name)
|
||||
|
||||
|
||||
|
||||
|
||||
elif (activityRemoved.queue_allowed and
|
||||
activityRemoved.queue_activity_number > 0) :
|
||||
warningMessage = _('There is a free place for the activity'
|
||||
print warning_message.format(activity_removed.name)
|
||||
#sortir de la boucle parcourissante la queue puisque
|
||||
# inscription faite
|
||||
break
|
||||
elif (activity_removed.queue_allowed and
|
||||
activity_removed.queue_activity_number > 0):
|
||||
warning_message = _('There is a free place for the activity'
|
||||
' : {}, you can fill it from the queue'
|
||||
' using the button on queue tab')
|
||||
print warningMessage.format(activityRemoved.name)
|
||||
print warning_message.format(activity_removed.name)
|
||||
return True
|
||||
|
||||
@api.constrains('activity_registration_ids')
|
||||
def _automatedRegistrationFromQueue(self):
|
||||
""" Automated Registration From Queue"""
|
||||
#verifier le nombre d'enregistr
|
||||
"""for member in self:
|
||||
for registration in member.activity_registration_ids:
|
||||
print '______________________________________________'
|
||||
print registration.activity_id.name"""
|
||||
|
||||
#verifier si nombre d'inscription sur activité est supérieur au place disponible
|
||||
#inviter l'utilisateur à s'inscrire sur l'attente
|
||||
@api.multi
|
||||
@api.onchange('activity_registration_ids')
|
||||
def _checkRegistrationNumber(self):
|
||||
def _check_registration_number(self):
|
||||
""" check activity registration number """
|
||||
self.ensure_one()
|
||||
member_id = self[0]
|
||||
|
||||
#recupérer la liste des inscription pour le membbre courant
|
||||
for registration in member_id.activity_registration_ids:
|
||||
#recupérer l'activité liée
|
||||
activity = registration.activity_id
|
||||
#vérifier si le nombre d'inscription depasse le nombre de places sur activité
|
||||
if len(activity.activity_registration_ids) > activity.places and activity.queue_allowed:
|
||||
warning_message = _('This activity : {} is already full, please'
|
||||
' discard changes and register in'
|
||||
@ -125,9 +118,10 @@ class GolemMember(models.Model):
|
||||
#lancer popup pour choisir activité à s'inscrire
|
||||
@api.multi
|
||||
def choose_queue_to_register(self):
|
||||
""" launch wizard to choose activity queue to register in"""
|
||||
self.ensure_one()
|
||||
member_id = self[0]
|
||||
|
||||
#lancer le wizard avec le membre actuel
|
||||
return {
|
||||
'name' : _('Choose the activity to register in'),
|
||||
'type' : 'ir.actions.act_window',
|
||||
|
@ -16,11 +16,8 @@ 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>
|
||||
|
||||
|
||||
<!--formulaire du modèle golem.activity.queue-->
|
||||
<record model="ir.ui.view" id="queue_form_view">
|
||||
<field name="name">queue.form</field>
|
||||
@ -37,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Recherche du modèle golem.activity.queue-->
|
||||
<record model="ir.ui.view" id="queue_search_view">
|
||||
<field name="name">queue.search</field>
|
||||
@ -69,7 +65,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="name">queue.tree</field>
|
||||
<field name="model">golem.activity.queue</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Queue Tree" editable="top" colors="grey: places_remain == 0; blue : places_remain >= 1">
|
||||
<tree string="Queue Tree"
|
||||
editable="top"
|
||||
colors="grey: places_remain == 0; blue : places_remain >= 1">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="member_id"/>
|
||||
<field name="activity_id"
|
||||
@ -82,9 +80,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Action -->
|
||||
<record id="golem_activity_queue_action" model="ir.actions.act_window">
|
||||
<field name="name">GOLEM Activity Queue List</field>
|
||||
|
@ -16,19 +16,18 @@ 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>
|
||||
<record id="golem_activity_form_inherit_golem_activity_queue"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Add the queue registration button to activity form</field>
|
||||
<field name="name">Add the queue registration items to activity form</field>
|
||||
<field name="model">golem.activity</field>
|
||||
<field name="inherit_id" ref="golem_activity.golem_activity_form" />
|
||||
<field name="arch" type="xml">
|
||||
<!--Ajout du case file d'attente et inscription automatisé sur activity form-->
|
||||
<xpath expr="//field[@name='is_overbooked']" position="after">
|
||||
<field name="queue_allowed" readonly='1'/>
|
||||
<field name="automated_registration_from_queue" readonly='1'/>
|
||||
<field name="auto_registration_from_queue" readonly='1'/>
|
||||
</xpath>
|
||||
<!--Ajout du bouton inscription en file d'attente sur activity form-->
|
||||
<xpath expr="//field[@name='activity_registration_ids']" position="after">
|
||||
@ -38,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<button class="oe_highlight" name="register_from_queue"
|
||||
string="Register from Queue" type="object"
|
||||
attrs="{'invisible':[('places_remain','<', 1)]}"/>
|
||||
|
||||
</xpath>
|
||||
<!--Ajout onglet queue sur activity form-->
|
||||
<xpath expr="//page[@name='invoicing']" position="before">
|
||||
@ -50,21 +48,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<tree editable="top">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="member_id"/>
|
||||
<!-- domain="[('season_ids', '=', season_id)]" /> -->
|
||||
<field name="activity_id" readonly="1" />
|
||||
<field name="season_id" readonly="1" />
|
||||
</tree>
|
||||
|
||||
</field>
|
||||
</group>
|
||||
<group>
|
||||
<button class="oe_highlight" name="register_from_queue"
|
||||
string="Register from Queue" type="object"/>
|
||||
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
<!--Ajout du bouton "ajouter une file"-->
|
||||
<!--Ajout du bouton "ajouter une file,supprimer file, automated et manual registration-->
|
||||
<xpath expr="//header" position="inside">
|
||||
<button class="oe_highlight" name="queue_allowed_toggle"
|
||||
string="Add Queue" type="object"
|
||||
@ -73,17 +68,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
string="Remove Queue" type="object"
|
||||
attrs="{'invisible': [('queue_allowed', '=', False)]}"
|
||||
confirm="Are you sure you want to remove queue from this activity ? This will delete all elements currently registred in"/>
|
||||
<button class="oe_highlight" name="automated_registration_from_queue_toggle"
|
||||
<button class="oe_highlight" name="auto_registration_from_queue_toggle"
|
||||
string="Automated registration from queue" type="object"
|
||||
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&', ('queue_allowed', '=', True), ('automated_registration_from_queue', '=', True)]}"
|
||||
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&', ('queue_allowed', '=', True), ('auto_registration_from_queue', '=', True)]}"
|
||||
confirm="Are you sure you want to switch to automated registration from queue mode ?"/>
|
||||
<button class="oe_highlight" name="automated_registration_from_queue_toggle"
|
||||
<button class="oe_highlight" name="auto_registration_from_queue_toggle"
|
||||
string="Manual registration from queue" type="object"
|
||||
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&', ('queue_allowed', '=', True), ('automated_registration_from_queue', '=', False)]}"
|
||||
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&', ('queue_allowed', '=', True), ('auto_registration_from_queue', '=', False)]}"
|
||||
confirm="Are you sure you want to switch to manual registration from queue mode ?"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
@ -18,8 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- add the queue registration button to member form-->
|
||||
<!-- add the queue registration items to member form-->
|
||||
<record id="golem_member_form_inherit_golem_activity_queue"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Add the queue onglet and registration button to member form</field>
|
||||
@ -36,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<page name="activities" position="after">
|
||||
<page name="queue" string="List of queues">
|
||||
<group>
|
||||
|
||||
<field name="activity_queue_ids"
|
||||
context="{'default_member_id': active_id}">
|
||||
<tree editable="top">
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
""" GOLEM Resources management """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo import models, fields
|
||||
|
||||
class GolemActivityAutomatedQueueActivateWizard(models.TransientModel):
|
||||
"""GOLEM Activity Automated Queue wizard : Activatate automated Queue """
|
||||
_name = "golem.activity.automated.queue.activate.wizard"
|
||||
|
||||
activity_id = fields.Many2one("golem.activity")
|
||||
automated_registration_from_queue = fields.Boolean(default=True)
|
||||
auto_registration_from_queue = fields.Boolean(default=True)
|
||||
|
||||
|
||||
# lancer liste editable d'inscription sur attente
|
||||
@ -36,7 +36,7 @@ class GolemActivityAutomatedQueueActivateWizard(models.TransientModel):
|
||||
activation = self[0]
|
||||
activation.activity_id.write({
|
||||
'queue_allowed': True,
|
||||
'automated_registration_from_queue': activation.automated_registration_from_queue
|
||||
'auto_registration_from_queue': activation.auto_registration_from_queue
|
||||
})
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</group>
|
||||
<group>
|
||||
<field name="activity_id" invisible="1" />
|
||||
<field name="automated_registration_from_queue"/>
|
||||
<field name="auto_registration_from_queue"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="activate_queue" string="Confirm" type="object"
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
""" GOLEM Resources management """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo import models, fields, _
|
||||
|
||||
class GolemActivityQueueChooseWizard(models.TransientModel):
|
||||
"""GOLEM Resource wizard : rchoose activity queue to register in """
|
||||
@ -31,15 +31,14 @@ class GolemActivityQueueChooseWizard(models.TransientModel):
|
||||
def register_in_queue(self):
|
||||
""" Choisir l'activité pour s'inscrire sur sa liste d'attente"""
|
||||
self.ensure_one()
|
||||
activityQueue = self[0]
|
||||
self.env['golem.activity.queue'].create({'member_id': activityQueue.member_id.id,
|
||||
'activity_id': activityQueue.activity_id.id})
|
||||
activity_queue = self[0]
|
||||
self.env['golem.activity.queue'].create({'member_id': activity_queue.member_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(activityQueue.member_id.name,
|
||||
activityQueue.activity_id.name))
|
||||
'message': (message.format(activity_queue.member_id.name,
|
||||
activity_queue.activity_id.name))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,8 @@ 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>
|
||||
@ -40,7 +38,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user