[IMP] event: refactored event form view. Usability reviews
showed that the form view was complicated and difficult to use. Now that stat button and edition options in the front-end exist, it is possible to remove some of the numerous tabs as well as some options from the form view. Coming: further cleaning of the model, behavior and probably the various event-related views.
This commit is contained in:
committed by
Thibault Delavallée
parent
16b560c441
commit
eb5adb8093
@@ -42,6 +42,9 @@ class event_event(models.Model):
|
||||
seats_max = fields.Integer(string='Maximum Available Seats', oldname='register_max',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )")
|
||||
seats_availability = fields.Selection(
|
||||
[('limited', 'Limited'), ('unlimited', 'Unlimited')],
|
||||
'Available Seat', required=True, default='unlimited')
|
||||
seats_min = fields.Integer(string='Minimum Reserved Seats', oldname='register_min',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
help="You can for each event define a minimum registration level. If you do not enough registrations you are not able to confirm your event. (put 0 to ignore this rule )")
|
||||
@@ -66,7 +69,7 @@ class event_event(models.Model):
|
||||
if self.ids:
|
||||
state_field = {
|
||||
'draft': 'seats_unconfirmed',
|
||||
'open':'seats_reserved',
|
||||
'open': 'seats_reserved',
|
||||
'done': 'seats_used',
|
||||
}
|
||||
query = """ SELECT event_id, state, sum(nb_register)
|
||||
@@ -98,8 +101,7 @@ class event_event(models.Model):
|
||||
def _tz_get(self):
|
||||
return [(x, x) for x in pytz.all_timezones]
|
||||
|
||||
date_tz = fields.Selection('_tz_get', string='Timezone',
|
||||
default=lambda self: self._context.get('tz', 'UTC'))
|
||||
date_tz = fields.Selection('_tz_get', string='Timezone', default=lambda self: self.env.user.tz)
|
||||
|
||||
@api.one
|
||||
@api.depends('date_tz', 'date_begin')
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<field name="name">Open Days in Los Angeles</field>
|
||||
<field eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 8:00:00')" name="date_begin"/>
|
||||
<field eval="(DateTime.now() + timedelta(days=5)).strftime('%Y-%m-%d 18:00:00')" name="date_end"/>
|
||||
<field name="seats_availability">limited</field>
|
||||
<field name="seats_max">500</field>
|
||||
<field name="address_id" ref="base.res_partner_6"/>
|
||||
<field name="type" ref="event_type_1"/>
|
||||
@@ -78,6 +79,7 @@
|
||||
<field eval="(DateTime.now() + timedelta(days=3)).strftime('%Y-%m-%d 11:00:00')" name="date_end"/>
|
||||
<field name="type" ref="event_type_0"/>
|
||||
<field name="address_id" ref="base.res_partner_5"/>
|
||||
<field name="seats_availability">limited</field>
|
||||
<field name="seats_max">350</field>
|
||||
<field name="description"><![CDATA[
|
||||
<div class="oe_structure">
|
||||
@@ -113,6 +115,7 @@
|
||||
<field eval="(DateTime.today()+ timedelta(days=5)).strftime('%Y-%m-%d 16:30:00')" name="date_end"/>
|
||||
<field name="type" ref="event_type_2"/>
|
||||
<field name="address_id" ref="base.res_partner_14"/>
|
||||
<field name="seats_availability">limited</field>
|
||||
<field name="seats_max">200</field>
|
||||
<field name="description"><![CDATA[
|
||||
<div class="oe_structure">
|
||||
@@ -155,6 +158,7 @@
|
||||
<field name="type" ref="event_type_4"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="address_id" ref="base.res_partner_2"/>
|
||||
<field name="seats_availability">unlimited</field>
|
||||
<field name="description"><![CDATA[
|
||||
<div class="oe_structure">
|
||||
<center><strong>5-days Technical Training</strong></center>
|
||||
|
||||
@@ -96,50 +96,10 @@
|
||||
<group>
|
||||
<field name="auto_confirm" invisible="1"/>
|
||||
<field name="seats_min" attrs="{'invisible':[('auto_confirm','=', True)]}"/>
|
||||
<field name="seats_max"/>
|
||||
<label for="seats_reserved" string="Current Registrations" groups="base.group_user"/>
|
||||
<div groups="base.group_user">
|
||||
<field name="seats_unconfirmed" class="oe_inline"/> (confirmed: <field name="seats_reserved" class="oe_inline"/>)
|
||||
</div>
|
||||
<field name="seats_used"/>
|
||||
<field name="seats_availability" widget='radio'/>
|
||||
<field name="seats_max" attrs="{'invisible':[('seats_availability','=','unlimited')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="registration_ids" colspan="4" nolabel="1" groups="event.group_event_manager,event.group_event_user" context="{'event_id': active_id}">
|
||||
<tree string="Registration" editable="top">
|
||||
<field name="name" />
|
||||
<field name="email" />
|
||||
<field name="phone"/>
|
||||
<field name="nb_register" />
|
||||
<field name="state"/>
|
||||
<button name="registration_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button name="button_reg_close" string="Attended the Event" states="open" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
<form string="Registration">
|
||||
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}"/>
|
||||
<field name="name"/>
|
||||
<group colspan="4" col="4">
|
||||
<field name="email"/>
|
||||
<field name="phone"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="nb_register"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<separator string="" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="state" colspan="2"/>
|
||||
<button name="registration_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button name="button_reg_close" string="Attended the Event" states="open" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Description">
|
||||
<field name="description" nolabel="1" placeholder="Event Description..."/>
|
||||
</page>
|
||||
<page string='Event Details' groups="base.group_no_one">
|
||||
<group colspan="4">
|
||||
|
||||
@@ -92,9 +92,6 @@
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
<field name="nb_register" position="after">
|
||||
<field name="event_ticket_id" domain="[('event_id', '=', context.get('event_id'))]"/>
|
||||
</field>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
@@ -121,21 +118,6 @@
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
<field name="nb_register" position="after">
|
||||
<field name="event_ticket_id" domain="[('event_id', '=', context.get('event_id'))]"/>
|
||||
</field>
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Badge">
|
||||
<label for="badge_back" class="oe_edit_only">Badge (Back)</label>
|
||||
<field name="badge_back" nolabel="1" placeholder="Event badge_back..."/>
|
||||
<hr/>
|
||||
<label for="badge_innerleft" class="oe_edit_only">Badge (Inner Left)</label>
|
||||
<field name="badge_innerleft" nolabel="1" placeholder="Event badge_innerleft..."/>
|
||||
<hr/>
|
||||
<label for="badge_innerright" class="oe_edit_only">Badge (Inner Right)</label>
|
||||
<field name="badge_innerright" nolabel="1" placeholder="Event badge_innerright..."/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -39,7 +39,7 @@ class website_event(http.Controller):
|
||||
return request.website.render("website_event_track.track_view", values)
|
||||
|
||||
def _prepare_calendar(self, event, event_track_ids):
|
||||
local_tz = pytz.timezone(event.timezone_of_event or 'UTC')
|
||||
local_tz = pytz.timezone(event.date_tz or 'UTC')
|
||||
locations = {} # { location: [track, start_date, end_date, rowspan]}
|
||||
dates = [] # [ (date, {}) ]
|
||||
for track in event_track_ids:
|
||||
|
||||
@@ -143,6 +143,12 @@ class event_event(osv.osv):
|
||||
for event in self.browse(cr, uid, ids, context=context)
|
||||
}
|
||||
|
||||
def _count_sponsor(self, cr, uid, ids, field_name, arg, context=None):
|
||||
return {
|
||||
event.id: len(event.sponsor_ids)
|
||||
for event in self.browse(cr, uid, ids, context=context)
|
||||
}
|
||||
|
||||
def _get_tracks_tag_ids(self, cr, uid, ids, field_names, arg=None, context=None):
|
||||
res = dict((res_id, []) for res_id in ids)
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
@@ -162,14 +168,13 @@ class event_event(osv.osv):
|
||||
'count_tracks': fields.function(_count_tracks, type='integer', string='Tracks'),
|
||||
'tracks_tag_ids': fields.function(_get_tracks_tag_ids, type='one2many', relation='event.track.tag', string='Tags of Tracks'),
|
||||
'allowed_track_tag_ids': fields.many2many('event.track.tag', string='Accepted Tags', help="List of available tags for track proposals."),
|
||||
'timezone_of_event': fields.selection(_list_tz, 'Event Timezone', size=64),
|
||||
'count_sponsor': fields.function(_count_sponsor, type='integer', string='Sponsors'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'show_track_proposal': False,
|
||||
'show_tracks': False,
|
||||
'show_blog': False,
|
||||
'timezone_of_event':lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).tz,
|
||||
}
|
||||
|
||||
def _get_new_menu_pages(self, cr, uid, event, context=None):
|
||||
|
||||
@@ -104,6 +104,37 @@
|
||||
</record>
|
||||
<menuitem id="menu_event_sponsor_type" action="action_event_sponsor_type" parent="event.event_configuration" groups="base.group_no_one"/>
|
||||
|
||||
<!-- EVENT.SPONSOR VIEWS -->
|
||||
<record model="ir.ui.view" id="view_event_sponsor_tree">
|
||||
<field name="name">event.sponsor.tree</field>
|
||||
<field name="model">event.sponsor</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="partner_id"/>
|
||||
<field name="url"/>
|
||||
<field name="sponsor_type_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_event_sponsor_search">
|
||||
<field name="name">event.sponsor.search</field>
|
||||
<field name="model">event.sponsor</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Event Sponsors">
|
||||
<field name="partner_id"/>
|
||||
<field name="event_id"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_event_sponsor_from_event">
|
||||
<field name="name">Event Tracks</field>
|
||||
<field name="res_model">event.sponsor</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_event_id': active_id, 'default_event_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
<!-- EVENTS/CONFIGURATION/EVENT Tags -->
|
||||
<record model="ir.ui.view" id="view_event_track_tag_form">
|
||||
<field name="name">Track Tags</field>
|
||||
@@ -163,15 +194,18 @@
|
||||
<field name="model">event.event</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@class='oe_right oe_button_box']" position="inside">
|
||||
<button name="%(website_event_track.act_event_list_tracks)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-inbox">
|
||||
<button name="%(act_event_list_tracks)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-inbox">
|
||||
<field name="count_tracks" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='organizer_id']" position="after">
|
||||
<field name="timezone_of_event" />
|
||||
<button name="%(action_event_sponsor_from_event)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-users">
|
||||
<field name="count_sponsor" widget="statinfo" class="oe_inline" string="Sponsorships"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='oe_title']" position="inside">
|
||||
<label for="tag_ids" class="oe_edit_only"/>
|
||||
@@ -185,28 +219,6 @@
|
||||
<label for="show_track_proposal"/>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Tracks">
|
||||
<group col="2" class="oe_title">
|
||||
<field name="allowed_track_tag_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
<field name="track_ids" context="{'default_event_id': active_id}"/>
|
||||
</page>
|
||||
<page string="Sponsorships">
|
||||
<field name="sponsor_ids" context="{'default_event_id': active_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="partner_id"/>
|
||||
<field name="url"/>
|
||||
<field name="sponsor_type_id"/>
|
||||
</tree>
|
||||
<form string="Sponsoring">
|
||||
<field name="partner_id"/>
|
||||
<field name="url"/>
|
||||
<field name="sponsor_type_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='oe_right oe_button_box']" position="inside">
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user