[IMP]GOLEM Activity Session : add minimum places and significant colors to tree
This commit is contained in:
parent
661849e8b7
commit
fd775e5a08
@ -61,6 +61,13 @@ class GolemActivitySession(models.Model):
|
||||
s.name = s.activity_id.activity_name
|
||||
|
||||
member_ids = fields.Many2many('golem.member', string='Members')
|
||||
places_used = fields.Integer('Places used', compute='_compute_places_used')
|
||||
|
||||
@api.depends('member_ids')
|
||||
def _compute_places_used(self):
|
||||
for s in self:
|
||||
s.places_used = len(s.member_ids)
|
||||
|
||||
# TODO: recurrence etc... to link with calendar.event
|
||||
activity_id = fields.Many2one('golem.activity', string='Activité',
|
||||
required=True)
|
||||
@ -86,6 +93,8 @@ class GolemActivitySession(models.Model):
|
||||
'after end of the period.'))
|
||||
|
||||
places = fields.Integer('Places', default=0)
|
||||
places_min = fields.Integer('Minimum places', default=0,
|
||||
help="Minimum places to maintain the session")
|
||||
is_overbooked = fields.Boolean('Allow overbook?', default=False)
|
||||
places_overbooked = fields.Integer('Places with overbook', default=0)
|
||||
places_remain = fields.Integer('Remaining places', store=True,
|
||||
|
@ -44,6 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="activity_id" />
|
||||
<field name="animator_id" />
|
||||
<field name="places" />
|
||||
<field name="places_min" />
|
||||
<field name="is_overbooked" />
|
||||
<field name="places_overbooked"
|
||||
attrs="{'invisible': [('is_overbooked', '=', False)]}" />
|
||||
@ -76,12 +77,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="name">Session list</field>
|
||||
<field name="model">golem.activity.session</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<tree colors="darkgrey: places_used < places_min;
|
||||
red: places_remain == 0;
|
||||
orange: places_remain <= 4;">
|
||||
<field name="activity_id" />
|
||||
<field name="animator_id" />
|
||||
<field name="weekday" />
|
||||
<field name="hour_start" />
|
||||
<field name="hour_end" />
|
||||
<field name="weekday" string="Day" />
|
||||
<field name="hour_start" string="Start" />
|
||||
<field name="hour_end" string="End" />
|
||||
<field name="places" />
|
||||
<field name="places_min" string="Min." />
|
||||
<field name="places_remain" string="Remain" />
|
||||
<field name="places_used" invisible="True" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
Loading…
Reference in New Issue
Block a user