[IMP]: Convert buttons into stat button in event module
bzr revid: ypa@tinyerp.com-20140326121108-odkq61lnf1cuyog5
This commit is contained in:
parent
3897de56b7
commit
b86c9ccd13
|
@ -135,6 +135,17 @@ class event_event(osv.osv):
|
|||
res[event.id]= True
|
||||
continue
|
||||
return res
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'count_regitrations': 0, 'count_tracks': 0,}), ids))
|
||||
try:
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
res[data.id] = {'count_regitrations': len(data.registration_ids),
|
||||
'count_tracks': len(data.track_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Event Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
|
@ -147,6 +158,7 @@ class event_event(osv.osv):
|
|||
'seats_unconfirmed': fields.function(_get_seats, oldname='register_prospect', string='Unconfirmed Seat Reservations', type='integer', multi='seats_reserved'),
|
||||
'seats_used': fields.function(_get_seats, oldname='register_attended', string='Number of Participations', type='integer', multi='seats_reserved'),
|
||||
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'track_ids': fields.one2many('event.track', 'event_id', 'Tracks', readonly=False),
|
||||
'date_begin': fields.datetime('Start Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'date_end': fields.datetime('End Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'state': fields.selection([
|
||||
|
@ -169,6 +181,8 @@ class event_event(osv.osv):
|
|||
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'),
|
||||
'organizer_id': fields.many2one('res.partner', "Organizer"),
|
||||
'count_regitrations': fields.function(_count_all, type="integer", string="Registrations", multi=True),
|
||||
'count_tracks': fields.function(_count_all, type='integer', string='Tracks', multi=True),
|
||||
}
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
|
|
|
@ -66,7 +66,13 @@
|
|||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" groups="base.group_user">
|
||||
<button name="%(event.act_event_list_register_event)d" type="action" string="Registrations" help="Register with this event"/>
|
||||
<button name="%(event.act_event_list_register_event)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-github"
|
||||
help="Register with this event">
|
||||
<field name="count_regitrations" widget="statinfo" string="Registrations"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
|
@ -363,11 +369,12 @@
|
|||
<field name="name"/>
|
||||
<field name="phone"/>
|
||||
<label for="email"/>
|
||||
<div>
|
||||
<div class="oe_button_box">
|
||||
<field name="email" class="oe_inline"/>
|
||||
<button class="oe_inline oe_right" string="Send Email"
|
||||
<button class="oe_inline oe_right oe_stat_button"
|
||||
string="Send Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
icon="terp-mail-message-new" context= '{"default_email_to":email}' type="action"/>
|
||||
icon="fa-reply-all" context= '{"default_email_to":email}' type="action"/>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
|
|
Loading…
Reference in New Issue