Correct function of queue register from activity form
This commit is contained in:
parent
321b25661a
commit
76315c1d15
@ -24,20 +24,27 @@ class GolemActivity(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
#ajout d'un champs O2M vers activity_id
|
#ajout d'un champs O2M vers activity_id
|
||||||
activity_queue_id = fields.One2many('golem.activity.queue', 'activity_id')
|
activity_queue_ids = fields.One2many('golem.activity.queue', 'activity_id')
|
||||||
# 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)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
def queue_register(self):
|
def queue_register(self):
|
||||||
|
self.ensure_one()
|
||||||
|
activity_id = self[0]
|
||||||
return {
|
return {
|
||||||
'name' : _('Register in the queue'),
|
'name' : _('Register in the queue'),
|
||||||
'type' : 'ir.actions.act_window',
|
'type' : 'ir.actions.act_window',
|
||||||
'res_model' : 'golem.activity.queue',
|
'res_model' : 'golem.activity.queue',
|
||||||
'view_mode': 'tree,form',
|
'context' :{'default_activity_id' : activity_id.id},
|
||||||
|
'domain' : [('activity_id', '=', activity_id.id)],# activity_id.name)],#"('activity_id', '=', True)"
|
||||||
|
'view_mode': 'tree',
|
||||||
'flags': {'action_buttons': True},
|
'flags': {'action_buttons': True},
|
||||||
'target': 'new',
|
'target': 'new',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('activity_registration_ids')
|
@api.onchange('activity_registration_ids')
|
||||||
def _checkRemain(self):
|
def _checkRemain(self):
|
||||||
if len(self.activity_registration_ids) > self.places and self.queue_allowed:
|
if len(self.activity_registration_ids) > self.places and self.queue_allowed:
|
||||||
|
@ -54,6 +54,8 @@ 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)
|
||||||
|
is_current = fields.Boolean('Current season?',
|
||||||
|
related='activity_id.is_current', store=True)
|
||||||
|
|
||||||
def call_up_wizard(self):
|
def call_up_wizard(self):
|
||||||
return {
|
return {
|
||||||
|
@ -44,9 +44,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="model">golem.activity.queue</field>
|
<field name="model">golem.activity.queue</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Queue Tree" editable="bottom">
|
<tree string="Queue Tree" editable="bottom">
|
||||||
<field name="activity_id"/>
|
|
||||||
<field name="season_id"/>
|
|
||||||
<field name="member_id"/>
|
<field name="member_id"/>
|
||||||
|
<field name="activity_id" readonly='1'/>
|
||||||
|
<field name="season_id" readonly='1'/>
|
||||||
|
<field name='test'/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user