colorisation conditionnelle de la liste des attente + filtre activité liée pleine

This commit is contained in:
eloyoussef 2018-02-23 00:22:34 +01:00
parent 3cc4ec92f0
commit 03c7ebc3d5
2 changed files with 19 additions and 1 deletions

View File

@ -30,7 +30,20 @@ class GolemActivityQueue(models.Model):
member_id = fields.Many2one('golem.member', required=True, ondelete='cascade')
is_current = fields.Boolean('Current season?',
related='activity_id.is_current', store=True)
#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",store=True)
# decider si l'activity liée est pleine ou non
@api.multi
@api.depends('places_remain')
def _isActivityFull(self):
for record in self:
if record.places_remain <=0:
record.is_activity_full = "Full activity"
else:
record.is_activity_full = "Not full activity"
def call_up_wizard(self):
return {
'name': 'Are you sure?',

View File

@ -51,6 +51,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
context="{'group_by': 'member_id'}"/>
<filter name="group_by_activity" string="Activity"
context="{'group_by': 'activity_id'}"/>
<filter name="group_by_is_full_activity" string="Activity full"
context="{'group_by': 'is_activity_full'}"/>
</group>
</search>
</field>
@ -60,11 +62,14 @@ 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="bottom">
<tree string="Queue Tree" editable="bottom" colors="grey: places_remain == 0; blue : places_remain &gt;= 1">
<field name="member_id"/>
<field name="activity_id" readonly='1'/>
<field name="season_id" readonly='1'/>
<field name="create_date" readonly="1"/>
<field name='places_remain' />
</tree>
</field>
</record>