forked from Yaltik/golem
Ajout du fonction d'activation de queue via un assistant et confirmation de traitement automatisé
This commit is contained in:
parent
1b3a187543
commit
17cc3dd906
@ -30,6 +30,7 @@
|
||||
'views/golem_activity_queue_views.xml',
|
||||
'views/golem_activity_views.xml',
|
||||
'views/golem_member_views.xml',
|
||||
'wizard/golem_activity_queue_choose_views.xml'
|
||||
'wizard/golem_activity_queue_choose_views.xml',
|
||||
'wizard/golem_activity_automated_queue_activate_views.xml'
|
||||
]
|
||||
}
|
||||
|
@ -86,7 +86,18 @@ class GolemActivity(models.Model):
|
||||
activity.automated_registration_from_queue = False
|
||||
|
||||
else:
|
||||
activity.queue_allowed = not activity.queue_allowed
|
||||
#lancer popup pour choisir activité à s'inscrire
|
||||
self.ensure_one()
|
||||
activity_id = self[0]
|
||||
|
||||
return {
|
||||
'name' : _('Choose the activity to register in'),
|
||||
'type' : 'ir.actions.act_window',
|
||||
'res_model' : 'golem.activity.automated.queue.activate.wizard',
|
||||
'view_mode': 'form',
|
||||
'context' : {'default_activity_id' : activity_id.id},
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -125,8 +125,6 @@ class GolemMember(models.Model):
|
||||
#lancer popup pour choisir activité à s'inscrire
|
||||
@api.multi
|
||||
def choose_queue_to_register(self):
|
||||
print "_________________________________________________"
|
||||
print self
|
||||
self.ensure_one()
|
||||
member_id = self[0]
|
||||
|
||||
|
@ -66,8 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<xpath expr="//header" position="inside">
|
||||
<button class="oe_highlight" name="queue_allowed_toggle"
|
||||
string="Add Queue" type="object"
|
||||
attrs="{'invisible': [('queue_allowed', '=', True)]}"
|
||||
confirm="Are you sure you want to do this?"/>
|
||||
attrs="{'invisible': [('queue_allowed', '=', True)]}"/>
|
||||
<button class="oe_highlight" name="queue_allowed_toggle"
|
||||
string="Remove Queue" type="object"
|
||||
attrs="{'invisible': [('queue_allowed', '=', False)]}"
|
||||
|
@ -17,3 +17,4 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from . import golem_activity_queue_choose
|
||||
from . import golem_activity_automated_queue_activate
|
||||
|
@ -0,0 +1,53 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# 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/>.
|
||||
|
||||
""" GOLEM Resources management """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
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)
|
||||
|
||||
|
||||
# lancer liste editable d'inscription sur attente
|
||||
def activate_queue(self):
|
||||
""" Activate Queue for the activity"""
|
||||
|
||||
self.ensure_one()
|
||||
activation = self[0]
|
||||
activation.activity_id.write({
|
||||
'queue_allowed': True,
|
||||
'automated_registration_from_queue': activation.automated_registration_from_queue
|
||||
})
|
||||
|
||||
|
||||
"""
|
||||
self.env['golem.activity.queue'].create({'member_id': activityQueue.member_id.id,
|
||||
'activity_id': activityQueue.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))
|
||||
}
|
||||
}"""
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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_automated_queue_actiave_wizard_view_form">
|
||||
<field name="name">GOLEM Activity Automated Queue Activate Wizard Form</field>
|
||||
<field name="model">golem.activity.automated.queue.activate.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Rejection reason">
|
||||
<group>
|
||||
<label
|
||||
class="oe_edit_only" for="name"
|
||||
string="Are you sure you want to Add queue to this activity ? If yes please confirm if you want automated registration from queue to activity"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="activity_id" invisible="1" />
|
||||
<field name="automated_registration_from_queue"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="activate_queue" string="Confirm" type="object"
|
||||
class="oe_highlight" />
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user