forked from Yaltik/golem
correction du groupement par état de remplissage d'activité
This commit is contained in:
parent
7bf11db34a
commit
9dcb1fec3f
@ -35,7 +35,16 @@ class GolemActivity(models.Model):
|
||||
queue_activity_number = fields.Integer(compute="_queue_activity_number",
|
||||
store=True, string='Pending registration number')
|
||||
|
||||
|
||||
#mettre à jour le status d'activité remplis sur chaque attente
|
||||
@api.constrains('places_remain')
|
||||
def updateActivityState(self):
|
||||
"""updates queue.is_activity_full based on places_remain"""
|
||||
for activity in self:
|
||||
for queue in self.activity_queue_ids:
|
||||
if activity.places_remain == 0:
|
||||
queue.is_activity_full = "Full activity"
|
||||
else:
|
||||
queue.is_activity_full = "Not full activity"
|
||||
#Ajouter/supprimer une file à l'activité et afficher popup pour traitement automatisé
|
||||
@api.multi
|
||||
def queue_allowed_toggle(self):
|
||||
|
@ -37,14 +37,15 @@ class GolemActivityQueue(models.Model):
|
||||
#nombre de place disponible sur activité liée
|
||||
places_remain = fields.Integer(related='activity_id.places_remain')
|
||||
#activité liée est plein ou non
|
||||
is_activity_full = fields.Char(compute="_isActivityFull")
|
||||
is_activity_full = fields.Char(compute="_isActivityFull", store=True)
|
||||
|
||||
sequence = fields.Integer()
|
||||
|
||||
|
||||
# decider si l'activity liée est pleine ou non : pour group by sur la liste
|
||||
@api.multi
|
||||
@api.depends('places_remain')
|
||||
def _isActivityFull(self):
|
||||
print "_____________________________________lklkkaaaa"
|
||||
for record in self:
|
||||
if record.places_remain == 0:
|
||||
record.is_activity_full = "Full activity"
|
||||
|
@ -45,7 +45,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="arch" type="xml">
|
||||
<search >
|
||||
<field name="member_id"/>
|
||||
<field name="activity_id" readonly='1'/>
|
||||
<field name="activity_id"/>
|
||||
<field name="season_id" />
|
||||
<filter name="season_default" string="Default season"
|
||||
domain="[('is_current', '=', True)]" />
|
||||
<group string="Group By">
|
||||
<filter name="group_by_member" string="Member"
|
||||
context="{'group_by': 'member_id'}"/>
|
||||
@ -62,12 +65,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="name">queue.tree</field>
|
||||
<field name="model">golem.activity.queue</field>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
|
||||
<tree string="Queue Tree" editable="top" colors="grey: places_remain == 0; blue : places_remain >= 1">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="member_id"/>
|
||||
<field name="activity_id"/>
|
||||
<field name="activity_id"
|
||||
domain="[('places_remain','<' , 1), ('queue_allowed', '=', True), ('is_current', '=', True)]"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="season_id" readonly='1'/>
|
||||
<field name="create_date" readonly="1"/>
|
||||
<field name='places_remain' />
|
||||
|
@ -38,17 +38,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<group>
|
||||
|
||||
<field name="activity_queue_ids"
|
||||
context="{'default_member_id': active_id}" readonly="1">
|
||||
context="{'default_member_id': active_id}">
|
||||
<tree editable="top">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="activity_id" readonly="1" />
|
||||
<field name="activity_id"
|
||||
domain="[('places_remain','<' , 1), ('queue_allowed', '=', True), ('is_current', '=', True)]"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="season_id" readonly="1" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group>
|
||||
<button class="oe_highlight" name="choose_queue_to_register" string="Register in the queue" type="object"/>
|
||||
</group>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
|
Loading…
x
Reference in New Issue
Block a user