sur event : il faudrait que title soit reconnu comme le nom du modéle
This commit is contained in:
parent
877632aab8
commit
797bef0aee
@ -12,7 +12,7 @@ class Event(models.Model):
|
|||||||
_description = 'Event model definition'
|
_description = 'Event model definition'
|
||||||
_order = 'id desc'
|
_order = 'id desc'
|
||||||
|
|
||||||
title = fields.Char(required=True)
|
name = fields.Char('Title', required=True)
|
||||||
manager_id = fields.Many2one('coworking.coworker', 'Manager', index=True,
|
manager_id = fields.Many2one('coworking.coworker', 'Manager', index=True,
|
||||||
domain="[('coworker_type', 'in', ['staffer', 'member'])]")
|
domain="[('coworker_type', 'in', ['staffer', 'member'])]")
|
||||||
date_start = fields.Datetime(default=fields.Date.context_today, required=True)
|
date_start = fields.Datetime(default=fields.Date.context_today, required=True)
|
||||||
@ -30,6 +30,13 @@ class Event(models.Model):
|
|||||||
participants_count = fields.Integer('Number of participants',
|
participants_count = fields.Integer('Number of participants',
|
||||||
compute='_compute_participants_count')
|
compute='_compute_participants_count')
|
||||||
|
|
||||||
|
|
||||||
|
@api.depends('participants_ids')
|
||||||
|
def _compute_participants_count(self):
|
||||||
|
""" Computes number of participants """
|
||||||
|
for event in self:
|
||||||
|
event.participants_count = len(event.participants_ids)
|
||||||
|
|
||||||
@api.depends('date_start')
|
@api.depends('date_start')
|
||||||
def _compute_starts_this_week(self):
|
def _compute_starts_this_week(self):
|
||||||
""" Computes is event starts this week """
|
""" Computes is event starts this week """
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<group name="group_top">
|
<group name="group_top">
|
||||||
<group name="group_left">
|
<group name="group_left">
|
||||||
<field name="title" />
|
<field name="name" />
|
||||||
<field name="manager_id" />
|
<field name="manager_id" />
|
||||||
<field name="date_start" />
|
<field name="date_start" />
|
||||||
<field name="starts_this_week" attrs="{'invisible': [('date_start', '=', True)]}" />
|
<field name="starts_this_week" attrs="{'invisible': [('date_start', '=', True)]}" />
|
||||||
@ -34,8 +34,8 @@
|
|||||||
<field name="name">event Tree</field>
|
<field name="name">event Tree</field>
|
||||||
<field name="model">coworking.event</field>
|
<field name="model">coworking.event</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree default_order="date_start desc, title asc">
|
<tree default_order="date_start desc, name asc">
|
||||||
<field name="title" />
|
<field name="name" />
|
||||||
<field name="manager_id" />
|
<field name="manager_id" />
|
||||||
<field name="date_start" />
|
<field name="date_start" />
|
||||||
<field name="participants_count" />
|
<field name="participants_count" />
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<field name="model">coworking.event</field>
|
<field name="model">coworking.event</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search>
|
<search>
|
||||||
<field name="title" />
|
<field name="name" />
|
||||||
<field name="manager_id" />
|
<field name="manager_id" />
|
||||||
|
|
||||||
<filter name="status_confirmed" string="Confirmed"
|
<filter name="status_confirmed" string="Confirmed"
|
||||||
@ -87,8 +87,8 @@
|
|||||||
<field name="model">coworking.event</field>
|
<field name="model">coworking.event</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<calendar date_start="date_start" date_stop="date_end"
|
<calendar date_start="date_start" date_stop="date_end"
|
||||||
display="Title : [title]" >
|
display="name : [name]" >
|
||||||
<field name="title" />
|
<field name="name" />
|
||||||
</calendar>
|
</calendar>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user