Correct function of queue register from activity form

This commit is contained in:
eloyoussef 2018-02-20 17:44:40 +01:00
parent 321b25661a
commit 76315c1d15
3 changed files with 14 additions and 4 deletions

View File

@ -24,20 +24,27 @@ class GolemActivity(models.Model):
#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é
queue_allowed = fields.Boolean(default=True)
@api.multi
def queue_register(self):
self.ensure_one()
activity_id = self[0]
return {
'name' : _('Register in the queue'),
'type' : 'ir.actions.act_window',
'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},
'target': 'new',
}
@api.onchange('activity_registration_ids')
def _checkRemain(self):
if len(self.activity_registration_ids) > self.places and self.queue_allowed:

View File

@ -54,6 +54,8 @@ class GolemActivityQueue(models.Model):
activity_id = fields.Many2one('golem.activity', required=True)
season_id = fields.Many2one(related='activity_id.season_id')
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):
return {

View File

@ -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="arch" type="xml">
<tree string="Queue Tree" editable="bottom">
<field name="activity_id"/>
<field name="season_id"/>
<field name="member_id"/>
<field name="activity_id" readonly='1'/>
<field name="season_id" readonly='1'/>
<field name='test'/>
</tree>
</field>
</record>