Ajout des boutons de changement de mode d'inscription depuis file

This commit is contained in:
eloyoussef 2018-02-27 19:20:12 +01:00
parent 17cc3dd906
commit 3ab701c8d4
2 changed files with 19 additions and 5 deletions

View File

@ -28,12 +28,16 @@ class GolemActivity(models.Model):
activity_queue_ids = fields.One2many('golem.activity.queue',
'activity_id','Pending registration')
# un booleen pour determiner si une fille d'attente est autorisé
queue_allowed = fields.Boolean(default=True)
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)
automated_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",
store=True, string='Pending registration number')
@api.multi
def automated_registration_from_queue_toggle(self):
for activity in self:
activity.automated_registration_from_queue = not activity.automated_registration_from_queue
@api.multi
def write(self, vals):

View File

@ -27,8 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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"/>
<field name="automated_registration_from_queue" attrs="{'readonly': [('queue_allowed','=', False )]}"/>
<field name="queue_allowed" readonly='1'/>
<field name="automated_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">
@ -36,7 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
string="Register in the queue" type="object"
attrs="{'invisible':[('places_remain','>', 0)]}"/>
<button class="oe_highlight" name="register_from_queue"
string="Register from Queue" type="object"/>
string="Register from Queue" type="object"
attrs="{'invisible':[('places_remain','&lt;', 1)]}"/>
</xpath>
<!--Ajout onglet queue sur activity form-->
@ -59,6 +60,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<group>
<button class="oe_highlight" name="register_from_queue"
string="Register from Queue" type="object"/>
</group>
</page>
</xpath>
@ -71,6 +73,14 @@ 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"
string="Automated registration from queue" type="object"
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&amp;', ('queue_allowed', '=', True), ('automated_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"
string="Manual registration from queue" type="object"
attrs="{'invisible': ['|', ('queue_allowed', '=', False),'&amp;', ('queue_allowed', '=', True), ('automated_registration_from_queue', '=', False)]}"
confirm="Are you sure you want to switch to manual registration from queue mode ?"/>
</xpath>
</field>
</record>