[IMP]shows location on days and fixes other bug.
bzr revid: vme@tinyerp.com-20140409100310-tiugx0jzxlwdphy6
This commit is contained in:
parent
2baf1c7a52
commit
4a1bc09a40
|
@ -27,6 +27,7 @@ import pytz
|
|||
from pytz import timezone
|
||||
from collections import OrderedDict
|
||||
from openerp import tools
|
||||
from operator import itemgetter
|
||||
|
||||
class event_track_tag(osv.osv):
|
||||
_name = "event.track.tag"
|
||||
|
@ -216,7 +217,7 @@ class event_track(osv.osv):
|
|||
'''
|
||||
local_dt = (datetime.datetime.strptime(time, tools.DEFAULT_SERVER_DATETIME_FORMAT)).replace(tzinfo=pytz.utc).astimezone(local_tz)
|
||||
local_tz.normalize(local_dt)
|
||||
return local_dt, local_dt + datetime.timedelta(minutes = duration), local_dt.strftime('%m-%d-%y')
|
||||
return local_dt, local_dt + datetime.timedelta(minutes = duration), local_dt.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
@staticmethod
|
||||
def generate_slots(date_and_durations, local_tz):
|
||||
|
@ -312,22 +313,34 @@ class event_track(osv.osv):
|
|||
row_skip_td[track_day][location_key] = row_skip_td[track_day] [location_key] + skip_time
|
||||
return row_skip_td, sort_tracks, talks
|
||||
|
||||
def get_location(self, cr, uid, location_list):
|
||||
def get_location(self, cr, uid, track_day, event_track):
|
||||
'''
|
||||
Params:
|
||||
location list: List
|
||||
rtype:List of location with name
|
||||
track_day: List
|
||||
event_track: List
|
||||
rtype: Dictionary containing {day:[(ID1, Name1),(ID2, Name2)],day1:[(ID3, Name3)]}
|
||||
**ID,Name of locations
|
||||
'''
|
||||
room_list = {}
|
||||
location_object = self.pool.get('event.track.location')
|
||||
locations = []
|
||||
for location_id in location_list:
|
||||
locations.append([location_id, location_object.browse(cr, uid, location_id).name])
|
||||
return locations
|
||||
|
||||
#Create Key(day) to display its related locations
|
||||
for day in track_day:room_list[day]= []
|
||||
|
||||
#Add location according to DAY
|
||||
for track in event_track:
|
||||
day_location_list = room_list[track['date'][:10]]
|
||||
if track['location_id'] and track['location_id'][0] not in [element[0] for element in day_location_list]:
|
||||
day_location_list.append([track['location_id'][0], location_object.browse(cr, uid, track['location_id'][0]).name])
|
||||
#sort locations
|
||||
for day in room_list:room_list[day]= sorted(room_list[day], key=itemgetter(0))
|
||||
return room_list
|
||||
|
||||
|
||||
def get_sorted_tracks(self, cr, uid, event, context=None):
|
||||
'''
|
||||
Params:
|
||||
event: Event module's browse object.
|
||||
event: Event module's browse object.
|
||||
|
||||
rtype: Dictionary containing
|
||||
event: event object
|
||||
|
@ -347,11 +360,11 @@ class event_track(osv.osv):
|
|||
row_skip_td, sort_tracks, talks = event_track.calculate_and_sort(sort_tracks)
|
||||
return {
|
||||
'event': event,
|
||||
'room_list': self.get_location(cr, uid, set([track['location_id'][0] for track in event_tracks if track['location_id']])),
|
||||
'location_by_days': self.get_location(cr, uid, sort_tracks.keys(), event_tracks),
|
||||
'days': sort_tracks,
|
||||
'row_skip_td': row_skip_td,
|
||||
'talks': talks,
|
||||
'format_date': [(datetime.datetime.strptime(day, '%m-%d-%y')).strftime("%d %B, %Y") for day in sort_tracks.keys()],
|
||||
'format_date': [(datetime.datetime.strptime(day, tools.DEFAULT_SERVER_DATE_FORMAT)).strftime("%d %B, %Y") for day in sort_tracks.keys()],
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<div class="col-md-12" id="right_column">
|
||||
<t t-foreach="days" t-as="day">
|
||||
<t t-set="index_of_day" t-value="(days.keys()).index(day)" />
|
||||
<t t-set="room_list" t-value="location_by_days[day]" />
|
||||
<h3 class="page-header mt0">
|
||||
<t t-esc="format_date[index_of_day]" />
|
||||
<small><t t-esc="(talks[day])"/> talks</small>
|
||||
|
@ -64,19 +65,33 @@
|
|||
</div>
|
||||
</h3>
|
||||
<table id="table_search" class="table table-bordered table-condensed">
|
||||
<t t-set="td_width" t-value="90/len(room_list)"/>
|
||||
<t t-if="len(room_list)"> <t t-set="td_width" t-value="90/len(room_list)"/></t>
|
||||
<t t-if="not len(room_list)"> <t t-set="td_width" t-value="1"/></t>
|
||||
<t t-set="index" t-value="0"/>
|
||||
<t t-set="for_all" t-value="True"/>
|
||||
<tr id="agenda_th">
|
||||
<th t-attf-style="width:#{10}%;"><small title="Timezone" class="text-muted"> <t t-esc= "event.timezone_of_event"/>* </small></th>
|
||||
<t t-foreach="room_list" t-as="room">
|
||||
<th t-attf-style="width: #{td_width}px;" class="active"><bold><t t-esc="room[1]"/></bold></th>
|
||||
<th t-attf-style="width: #{td_width}px;" class="active text-center"><bold><t t-esc="room[1]"/></bold></th>
|
||||
</t>
|
||||
<t t-if="len(room_list) == 0">
|
||||
<th class="active"> </th>
|
||||
</t>
|
||||
</tr>
|
||||
<t t-foreach="days[day]" t-as="slot">
|
||||
<t t-set="skip_it" t-value="row_skip_td[day].keys()"/>
|
||||
<tr id="agenda_tr">
|
||||
<td t-attf-style="width:#{10}%;"><t t-esc= "slot"/></td>
|
||||
<t t-if="not len(room_list)">
|
||||
<t t-if="len(days[day][slot])">
|
||||
<t t-set="record" t-value="days[day][slot][0]"/>
|
||||
<td id="seach_enable" t-attf-class="event_color_#{record['color']} text-center">
|
||||
<img t-if="not record['website_published']" title="Not Published" style="width:10px; height:10px" src="/web/static/src/img/icons/gtk-no.png" />
|
||||
<a t-attf-href="/event/#{ slug(event) }/track/#{ slug([record['id'], record['name']]) }"> <t t-esc="record['name']" /> </a>
|
||||
<br/><small class="text-muted"> <t t-esc="record['speaker_ids']" /></small>
|
||||
</td>
|
||||
</t>
|
||||
</t>
|
||||
<t t-foreach="room_list" t-as="room">
|
||||
<t t-set="sid" t-value="not (room[0] in skip_it and slot in row_skip_td[day][room[0]])" />
|
||||
<t t-if="sid">
|
||||
|
@ -100,7 +115,7 @@
|
|||
</td>
|
||||
</t>
|
||||
<t t-if="record['location_id'][0] == room[0]" >
|
||||
<td t-att-rowspan="record['row_span']" t-attf-style="width: #{td_width}px;" t-attf-class="event_color_#{record['color']}" id="seach_enable">
|
||||
<td t-att-rowspan="record['row_span']" t-attf-style="width: #{td_width}px;" t-attf-class="event_color_#{record['color']} text-center" id="seach_enable">
|
||||
<img t-if="not record['website_published']" title="Not Published" style="width:10px; height:10px" src="/web/static/src/img/icons/gtk-no.png" />
|
||||
<a t-attf-href="/event/#{ slug(event) }/track/#{ slug([record['id'], record['name']]) }"> <t t-esc="record['name']" /> </a>
|
||||
<br/><small class="text-muted"> <t t-esc="record['speaker_ids']" /></small>
|
||||
|
|
Loading…
Reference in New Issue