[IMP] event, event_sale, website_event_track: usability improvements
Among others small improvements : - [event] remove automatic logging of new registrations on event; for big events it produces only noise - [event_sale] fix product creation from event management; better display of address and date of the event - [website_event_track] add a cancel state on the track model. The stat button on the event shows only not-canceled state. Also added some tips.
This commit is contained in:
committed by
Thibault Delavallée
parent
269ff99f24
commit
8ada8b8276
@@ -60,13 +60,13 @@ class event_event(models.Model):
|
||||
seats_max = fields.Integer(
|
||||
string='Maximum Available Seats', oldname='register_max',
|
||||
readonly=True, states={'draft': [('readonly', False)], 'confirm': [('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 )")
|
||||
help="For each event you can define a maximum registration of seats(number of attendees), above this numbers the registrations are not accepted.")
|
||||
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',
|
||||
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 )")
|
||||
string='Minimum Reservation of Seats Required', oldname='register_min',
|
||||
help="For each event you can define a minimum reserved seats(number of attendees), if it does not reach the mentioned registrations the event can not be confirmed (keep 0 to ignore this rule)")
|
||||
seats_reserved = fields.Integer(
|
||||
oldname='register_current', string='Reserved Seats',
|
||||
store=True, readonly=True, compute='_compute_seats')
|
||||
@@ -160,7 +160,7 @@ class event_event(models.Model):
|
||||
|
||||
@api.one
|
||||
def _compute_auto_confirm(self):
|
||||
self.auto_confirm = self.env['ir.values'].get_default('marketing.config.settings', 'auto_confirmation')
|
||||
self.auto_confirm = self.env['ir.values'].get_default('event.config.settings', 'auto_confirmation')
|
||||
|
||||
reply_to = fields.Char(
|
||||
'Reply-To Email', readonly=False, states={'done': [('readonly', True)]},
|
||||
@@ -336,9 +336,6 @@ class event_registration(models.Model):
|
||||
|
||||
@api.one
|
||||
def confirm_registration(self):
|
||||
self.event_id.message_post(
|
||||
body=_('New registration confirmed: %s.') % (self.name or ''),
|
||||
subtype="event.mt_event_registration")
|
||||
self.state = 'open'
|
||||
|
||||
# auto-trigger after_sub (on subscribe) mail schedulers, if needed
|
||||
|
||||
@@ -13,13 +13,6 @@
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<!-- Event-related subtypes for messaging / Chatter -->
|
||||
<record id="event.mt_event_registration" model="mail.message.subtype">
|
||||
<field name="name">New Registration</field>
|
||||
<field name="res_model">event.event</field>
|
||||
<field name="default" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- notify all employees of module installation -->
|
||||
<function model="mail.channel" name="message_post">
|
||||
<value eval="[ref('mail.channel_all_employees')]"/>
|
||||
@@ -28,7 +21,7 @@
|
||||
</function>
|
||||
|
||||
<!-- Automatic confirmation of events by default -->
|
||||
<function id="default_auto_confirmation" model="ir.values" name="set_default" eval="('marketing.config.settings', 'auto_confirmation', True)"/>
|
||||
<function id="default_auto_confirmation" model="ir.values" name="set_default" eval="('event.config.settings', 'auto_confirmation', True)"/>
|
||||
|
||||
<!-- Event Mail Scheduler-->
|
||||
<record model="ir.cron" forcecreate="True" id="event_mail_scheduler">
|
||||
|
||||
@@ -36,4 +36,4 @@ class event_config_settings(osv.TransientModel):
|
||||
|
||||
def set_default_auto_confirmation(self, cr, uid, ids, context=None):
|
||||
config_value = self.browse(cr, uid, ids, context=context).auto_confirmation
|
||||
self.pool.get('ir.values').set_default(cr, uid, 'marketing.config.settings', 'auto_confirmation', config_value)
|
||||
self.pool.get('ir.values').set_default(cr, uid, 'event.config.settings', 'auto_confirmation', config_value)
|
||||
|
||||
@@ -13,7 +13,7 @@ class TestEventFlow(TestEventCommon):
|
||||
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.models')
|
||||
def test_00_basic_event_auto_confirm(self):
|
||||
""" Basic event management with auto confirmation """
|
||||
self.env['ir.values'].set_default('marketing.config.settings', 'auto_confirmation', True)
|
||||
self.env['ir.values'].set_default('event.config.settings', 'auto_confirmation', True)
|
||||
|
||||
# EventUser creates a new event: ok
|
||||
test_event = self.Event.sudo(self.user_eventmanager).create({
|
||||
@@ -66,7 +66,7 @@ class TestEventFlow(TestEventCommon):
|
||||
def test_10_advanced_event_flow(self):
|
||||
""" Avanced event flow: no auto confirmation, manage minimum / maximum
|
||||
seats, ... """
|
||||
self.env['ir.values'].set_default('marketing.config.settings', 'auto_confirmation', False)
|
||||
self.env['ir.values'].set_default('event.config.settings', 'auto_confirmation', False)
|
||||
|
||||
# EventUser creates a new event: ok
|
||||
test_event = self.Event.sudo(self.user_eventmanager).create({
|
||||
|
||||
@@ -13,7 +13,7 @@ class TestMailSchedule(TestEventCommon):
|
||||
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.models')
|
||||
def test_00_event_mail_schedule(self):
|
||||
""" Test mail scheduling for events """
|
||||
self.env['ir.values'].set_default('marketing.config.settings', 'auto_confirmation', True)
|
||||
self.env['ir.values'].set_default('event.config.settings', 'auto_confirmation', True)
|
||||
now = fields.datetime.now()
|
||||
event_date_begin = now + relativedelta(days=1)
|
||||
event_date_end = now + relativedelta(days=3)
|
||||
|
||||
@@ -88,8 +88,8 @@ class event_ticket(models.Model):
|
||||
[('limited', 'Limited'), ('unlimited', 'Unlimited')],
|
||||
'Available Seat', required=True, store=True, compute='_compute_seats', default="limited")
|
||||
seats_max = fields.Integer('Maximum Available Seats',
|
||||
help="Define the number of available tickets. If you have too much registrations you will"
|
||||
"not BE able to sell tickets anymore. Set 0 to ignore this rule set as unlimited.")
|
||||
help="Define the number of available tickets. If you have too much registrations you will "
|
||||
"not be able to sell tickets anymore. Set 0 to ignore this rule set as unlimited.")
|
||||
seats_reserved = fields.Integer(string='Reserved Seats', compute='_compute_seats', store=True)
|
||||
seats_available = fields.Integer(string='Available Seats', compute='_compute_seats', store=True)
|
||||
seats_unconfirmed = fields.Integer(string='Unconfirmed Seat Reservations', compute='_compute_seats', store=True)
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<field name="event_ticket_ids" context="{'default_name': name}">
|
||||
<tree string="Tickets" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_id" context="{'default_event_ok':1}"/>
|
||||
<field name="deadline"/>
|
||||
<field name="price"/>
|
||||
<field name="seats_max"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_id']" position="after">
|
||||
<field name="event_id" domain="['|', ('type','=', False),('type', '=', event_type_id),('date_end','>=',time.strftime('%Y-%m-%d 00:00:00'))]" attrs="{'invisible': [('event_ok', '=', False)],'required': [('event_ok', '!=', False)]}"/>
|
||||
<field name="event_ticket_id" domain="[('event_id', '=', event_id), ('seats_available', '>', 0)]" attrs="{'invisible': [('event_id', '=', False)]}"
|
||||
<field name="event_ticket_id" domain="[('event_id', '=', event_id), ('seats_available', '>', 0)]" attrs="{'invisible': [('event_id', '=', False)], 'required': [('event_id', '!=', False)]}"
|
||||
on_change="onchange_event_ticket_id(event_ticket_id, context)"/>
|
||||
<field name="event_type_id" invisible="1"/>
|
||||
<field name="event_ok" invisible="1"/>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<footer>
|
||||
<button string="Apply" name="action_make_registration" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
<button string="Skip" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -240,7 +240,11 @@
|
||||
<section class="container">
|
||||
<h1 class="text-center">Event Location</h1>
|
||||
</section>
|
||||
<div class="oe_structure oe_empty"/>
|
||||
<h4 class="text-center text-muted"
|
||||
t-field="event.address_id" t-field-options='{
|
||||
"widget": "contact",
|
||||
"fields": ["address", "phone", "mobile", "fax"]
|
||||
}'/>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
@@ -260,7 +264,7 @@
|
||||
<h4 class="text-center text-muted">
|
||||
<i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.date_begin_located" t-field-options='{"hide_seconds":"True"}'/> to
|
||||
<span itemprop="endDate" t-field="event.date_end_located" t-field-options='{"hide_seconds":"True"}'/>
|
||||
(<span t-field="event.date_tz"/>)
|
||||
<t t-if="event.date_tz">(<span t-field="event.date_tz"/>)</t>
|
||||
</h4>
|
||||
<h4 class="text-center text-muted"
|
||||
t-field="event.address_id" t-field-options='{
|
||||
@@ -465,7 +469,7 @@
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left">
|
||||
<button type="submit" class="btn btn-primary">Continue</button> or
|
||||
<a class="js_goto_event"> Cancel Registration</a>
|
||||
<a class="js_goto_event" style="cursor: pointer;"> Cancel Registration</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,7 @@ Adds support for:
|
||||
'data/event_data.xml',
|
||||
'views/website_event.xml',
|
||||
'views/event_backend.xml',
|
||||
'data/event_track_tip_data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/event.xml',
|
||||
],
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record model="web.tip" id="event_track_tip_1">
|
||||
<field name="description">Switch to the calendar view to see the availability of each room.</field>
|
||||
<field name="action_id" ref="action_event_track_from_event"/>
|
||||
<field name="model">event.track</field>
|
||||
<field name="mode">kanban</field>
|
||||
<field name="trigger_selector">.o_kanban_record:visible</field>
|
||||
<field name="highlight_selector">button[data-view-type=calendar]</field>
|
||||
<field name="end_event">mousedown</field>
|
||||
<field name="placement">bottom</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -41,7 +41,7 @@ class event_track(models.Model):
|
||||
speaker_ids = fields.Many2many('res.partner', string='Speakers')
|
||||
tag_ids = fields.Many2many('event.track.tag', string='Tags')
|
||||
state = fields.Selection([
|
||||
('draft', 'Proposal'), ('confirmed', 'Confirmed'), ('announced', 'Announced'), ('published', 'Published'), ('refused', 'Refused')],
|
||||
('draft', 'Proposal'), ('confirmed', 'Confirmed'), ('announced', 'Announced'), ('published', 'Published'), ('refused', 'Refused'), ('cancel', 'Cancelled')],
|
||||
'Status', default='draft', required=True, copy=False, track_visibility='onchange')
|
||||
description = fields.Html('Track Description', translate=True)
|
||||
date = fields.Datetime('Track Date')
|
||||
@@ -88,6 +88,8 @@ class event_track(models.Model):
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
if vals.get('state') == 'published':
|
||||
vals.update({'website_published': True})
|
||||
res = super(event_track, self).write(vals)
|
||||
if vals.get('speaker_ids'):
|
||||
self.message_subscribe([speaker['id'] for speaker in self.resolve_2many_commands('speaker_ids', vals['speaker_ids'], ['id'])])
|
||||
@@ -105,7 +107,7 @@ class event_track(models.Model):
|
||||
if groupby and groupby[0] == "state":
|
||||
# Default result structure
|
||||
# states = self._get_state_list(cr, uid, context=context)
|
||||
states = [('draft', 'Proposal'), ('confirmed', 'Confirmed'), ('announced', 'Announced'), ('published', 'Published')]
|
||||
states = [('draft', 'Proposal'), ('confirmed', 'Confirmed'), ('announced', 'Announced'), ('published', 'Published'), ('cancel', 'Cancelled')]
|
||||
read_group_all_states = [{
|
||||
'__context': {'group_by': groupby[1:]},
|
||||
'__domain': domain + [('state', '=', state_value)],
|
||||
@@ -120,6 +122,8 @@ class event_track(models.Model):
|
||||
res = filter(lambda x: x['state'] == state_value, read_group_res)
|
||||
if not res:
|
||||
res = filter(lambda x: x['state'] == state_value, read_group_all_states)
|
||||
if state_value == 'cancel':
|
||||
res[0]['__fold'] = True
|
||||
res[0]['state'] = [state_value, state_name]
|
||||
result.append(res[0])
|
||||
return result
|
||||
@@ -142,9 +146,13 @@ class event_track(models.Model):
|
||||
class event_event(models.Model):
|
||||
_inherit = "event.event"
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
def _count_tracks(self):
|
||||
self.count_tracks = len(self.track_ids)
|
||||
track_data = self.env['event.track'].read_group([('state', '!=', 'cancel')],
|
||||
['event_id', 'state'], ['event_id'])
|
||||
result = dict((data['event_id'][0], data['event_id_count']) for data in track_data)
|
||||
for event in self:
|
||||
event.count_tracks = result.get(event.id, 0)
|
||||
|
||||
@api.one
|
||||
def _count_sponsor(self):
|
||||
@@ -159,7 +167,7 @@ class event_event(models.Model):
|
||||
sponsor_ids = fields.One2many('event.sponsor', 'event_id', 'Sponsors')
|
||||
blog_id = fields.Many2one('blog.blog', 'Event Blog')
|
||||
show_track_proposal = fields.Boolean('Talks Proposals')
|
||||
show_tracks = fields.Boolean('Multiple Tracks')
|
||||
show_tracks = fields.Boolean('Show Tracks on Website')
|
||||
show_blog = fields.Boolean('News')
|
||||
count_tracks = fields.Integer('Tracks', compute='_count_tracks')
|
||||
allowed_track_tag_ids = fields.Many2many('event.track.tag', relation='event_allowed_track_tags_rel', string='Available Track Tags')
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
<search string="Event Tracks">
|
||||
<field name="name"/>
|
||||
<field name="event_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="state"/>
|
||||
<field name="speaker_ids"/>
|
||||
<filter string="New Mail" name="message_unread" domain="[('message_unread','=',True)]"/>
|
||||
|
||||
Reference in New Issue
Block a user