Ajout warning au cas de depassement de place
This commit is contained in:
parent
a64d865648
commit
9fdb1cbddc
@ -24,16 +24,23 @@ class YesNoQueuePopUp(models.TransientModel):
|
|||||||
_name = "golem.queuepopup"
|
_name = "golem.queuepopup"
|
||||||
|
|
||||||
|
|
||||||
yes_no = fields.Char(default='Do you want to proceed?')
|
#yes_no = fields.Char(default='Do you want to proceed?')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def yes(self):
|
def queueYes(self):
|
||||||
pass
|
print "########################################################"
|
||||||
# sure continue!
|
return {
|
||||||
|
'name' : _('Do you want to add your registration to the queue?'),
|
||||||
|
'type' : 'ir.actions.act_window',
|
||||||
|
'res_model' : 'golem.activity.queue',
|
||||||
|
'view_mode': 'form',
|
||||||
|
'view_type': 'form',
|
||||||
|
'target': 'new',
|
||||||
|
}
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def no(self):
|
def queueNo(self):
|
||||||
pass # don't do anything stupid
|
pass # don't do anything
|
||||||
|
|
||||||
|
|
||||||
class GolemActivity(models.Model):
|
class GolemActivity(models.Model):
|
||||||
@ -46,39 +53,53 @@ class GolemActivity(models.Model):
|
|||||||
# un boolen pour determiner si une fille d'attente est autorisé
|
# un boolen pour determiner si une fille d'attente est autorisé
|
||||||
queue_allowed = fields.Boolean(default=True)
|
queue_allowed = fields.Boolean(default=True)
|
||||||
|
|
||||||
|
def queue_register(self):
|
||||||
|
return {
|
||||||
|
'name' : _('Register in the queue'),
|
||||||
|
'type' : 'ir.actions.act_window',
|
||||||
|
'res_model' : 'golem.activity.queue',
|
||||||
|
'view_mode': 'form',
|
||||||
|
'view_type': 'form',
|
||||||
|
'target': 'new',
|
||||||
|
}
|
||||||
|
|
||||||
|
@api.onchange('activity_registration_ids')
|
||||||
|
def _checkRemain(self):
|
||||||
|
|
||||||
|
if len(self.activity_registration_ids) > self.places and self.queue_allowed:
|
||||||
|
return {
|
||||||
|
'warning' : {
|
||||||
|
'title' : _('Warning'),
|
||||||
|
'message': _('No remaining place, please register in the queue'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('places_remain')
|
@api.constrains('places_remain')
|
||||||
def _check_remaining_places(self):
|
def _check_remaining_places(self):
|
||||||
""" Forbid inscription when there is no more place """
|
#Forbid inscription when there is no more place
|
||||||
for activity in self:
|
for activity in self:
|
||||||
if activity.places_remain < 5:
|
if activity.places_remain < 5:
|
||||||
|
|
||||||
if self.queue_allowed:
|
if self.queue_allowed:
|
||||||
print "__________________________ test ______________________"
|
print "__________________________ test ______________________"
|
||||||
return {
|
|
||||||
'name' : _('Please enter the reseaon of rejection'),
|
|
||||||
'type' : 'ir.actions.act_window',
|
|
||||||
'res_model' : 'golem.queuepopup',
|
|
||||||
'view_mode': 'form',
|
|
||||||
'view_type': 'form',
|
|
||||||
'target': 'new',
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name' : _('Do you want to add your registration to the queue?'),
|
'name' : _('Do you want to add your registration to the queue?'),
|
||||||
'type' : 'ir.actions.act_window',
|
'type' : 'ir.actions.act_window',
|
||||||
'res_model' : 'golem.queuepopup',
|
'res_model' : 'golem.activity.queue',
|
||||||
'view_mode': 'form',
|
'view_mode': 'form',
|
||||||
'view_type': 'form',
|
'view_type': 'form',
|
||||||
'target': 'new',
|
'target': 'new',
|
||||||
}
|
}
|
||||||
print "________________________________test 2 __________________"
|
print "________________________________test 2 __________________"
|
||||||
|
raise models.ValidationError("erreur")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
emsg = _('Sorry, there is no more place man !')
|
emsg = _('Sorry, there is no more place man !')
|
||||||
raise models.ValidationError(emsg)
|
raise models.ValidationError(emsg)
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -91,3 +112,13 @@ class GolemActivityQueue(models.Model):
|
|||||||
activity_id = fields.Many2one('golem.activity', required=True)
|
activity_id = fields.Many2one('golem.activity', required=True)
|
||||||
season_id = fields.Many2one(related='activity_id.season_id')
|
season_id = fields.Many2one(related='activity_id.season_id')
|
||||||
member_id = fields.Many2one('golem.member', required=True)
|
member_id = fields.Many2one('golem.member', required=True)
|
||||||
|
|
||||||
|
def call_up_wizard(self):
|
||||||
|
return {
|
||||||
|
'name': 'Are you sure?',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'golem.queuepopup',
|
||||||
|
'view_mode': 'form',
|
||||||
|
'view_type': 'form',
|
||||||
|
'target': 'new',
|
||||||
|
}
|
||||||
|
@ -20,7 +20,44 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<!--formulaire du modèle golem.resources-->
|
||||||
|
<record model="ir.ui.view" id="queue_form_view">
|
||||||
|
<field name="name">queue.form</field>
|
||||||
|
<field name="model">golem.activity.queue</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Queue Form">
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
|
<field name="activity_id"/>
|
||||||
|
<field name="season_id"/>
|
||||||
|
<field name="member_id"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--liste editable du modèle golem.activity.queue-->
|
||||||
|
<record model="ir.ui.view" id="queue_tree_view">
|
||||||
|
<field name="name">queue.tree</field>
|
||||||
|
<field name="model">golem.activity.queue</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Queue Tree" editable="top">
|
||||||
|
<field name="activity_id"/>
|
||||||
|
<field name="season_id"/>
|
||||||
|
<field name="member_id"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="action_queue">
|
||||||
|
<field name="name">Resources Type</field>
|
||||||
|
<field name="res_model">golem.activity.queue</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
</record>
|
||||||
|
<!--menu principale et sous menu-->
|
||||||
|
<menuitem id="queue_menu" name="Queue" action="action_queue"/>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -27,6 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<xpath expr="//field[@name='is_overbooked']" position="after">
|
<xpath expr="//field[@name='is_overbooked']" position="after">
|
||||||
<field name="queue_allowed"/>
|
<field name="queue_allowed"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='activity_registration_ids']" position="after">
|
||||||
|
<button class="oe_highlight" name="queue_register" string="Register in the queue" type="object"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -36,11 +39,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Add motif">
|
<form string="Add motif">
|
||||||
<field name="yes_no" readonly="1" />
|
<footer>
|
||||||
<!--<footer>
|
<button class="oe_highlight" name="queueYes" string="Yes" type="object"/>
|
||||||
<button class="oe_highlight" name="yes" string="Yes" />
|
<button class="oe_highlight" name="queueNo" string="No" type="object"/>
|
||||||
<button class="oe_highlight" name="no" string="No" />
|
</footer>
|
||||||
</footer>-->
|
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user