forked from Yaltik/golem
Ajout de fonction qui supprime les elemetes inscrit en attente en cas de désactivation de l'attente
This commit is contained in:
parent
08c949d6e2
commit
1b3a187543
@ -72,10 +72,19 @@ class GolemActivity(models.Model):
|
|||||||
#Ajouter/supprimer une file à l'activité et afficher popup pour traitement automatisé
|
#Ajouter/supprimer une file à l'activité et afficher popup pour traitement automatisé
|
||||||
@api.multi
|
@api.multi
|
||||||
def queue_allowed_toggle(self):
|
def queue_allowed_toggle(self):
|
||||||
|
""" Toggle queue_alowed boolean """
|
||||||
for activity in self:
|
for activity in self:
|
||||||
|
#si l'activité contient une file
|
||||||
if activity.queue_allowed:
|
if activity.queue_allowed:
|
||||||
activity.queue_allowed = not activity.queue_allowed
|
# si la queue déja contient des elements à supprimer
|
||||||
|
if len(activity.activity_queue_ids) > 0:
|
||||||
|
#parcourir et supprimer les element de la queue
|
||||||
|
for queue in activity.activity_queue_ids:
|
||||||
|
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.automated_registration_from_queue = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
activity.queue_allowed = not activity.queue_allowed
|
activity.queue_allowed = not activity.queue_allowed
|
||||||
|
|
||||||
|
@ -52,13 +52,14 @@ class GolemActivityQueue(models.Model):
|
|||||||
# decider si l'activity liée est pleine ou non : pour group by sur la liste
|
# decider si l'activity liée est pleine ou non : pour group by sur la liste
|
||||||
@api.depends('places_remain')
|
@api.depends('places_remain')
|
||||||
def _isActivityFull(self):
|
def _isActivityFull(self):
|
||||||
print "_____________________________________lklkkaaaa"
|
""" Decide if activity is full or not """
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.places_remain == 0:
|
if record.places_remain == 0:
|
||||||
record.is_activity_full = "Full activity"
|
record.is_activity_full = "Full activity"
|
||||||
else:
|
else:
|
||||||
record.is_activity_full = "Not full activity"
|
record.is_activity_full = "Not full activity"
|
||||||
@api.constrains('member_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 """
|
||||||
|
@ -66,10 +66,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<xpath expr="//header" position="inside">
|
<xpath expr="//header" position="inside">
|
||||||
<button class="oe_highlight" name="queue_allowed_toggle"
|
<button class="oe_highlight" name="queue_allowed_toggle"
|
||||||
string="Add Queue" type="object"
|
string="Add Queue" type="object"
|
||||||
attrs="{'invisible': [('queue_allowed', '=', True)]}"/>
|
attrs="{'invisible': [('queue_allowed', '=', True)]}"
|
||||||
|
confirm="Are you sure you want to do this?"/>
|
||||||
<button class="oe_highlight" name="queue_allowed_toggle"
|
<button class="oe_highlight" name="queue_allowed_toggle"
|
||||||
string="Remove Queue" type="object"
|
string="Remove Queue" type="object"
|
||||||
attrs="{'invisible': [('queue_allowed', '=', False)]}"/>
|
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"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user