[FIX] website_event: access right for public user

bzr revid: chm@openerp.com-20130806093115-1bhh873xhycdag84
This commit is contained in:
Christophe Matthieu 2013-08-06 11:31:15 +02:00
parent f55561d154
commit 472b547c30
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.translate import _
@ -97,8 +98,11 @@ class website_event(http.Controller):
def event(self, event_id=None, **post):
website = request.registry['website']
event = request.registry['event.event'].browse(request.cr, request.uid, event_id)
organizer = event.user_id and request.registry['res.users'].browse(request.cr, SUPERUSER_ID, event.user_id.id) or None
values = website.get_rendering_context({
'event_id': event,
'organizer': organizer,
'google_map_url': "http://maps.googleapis.com/maps/api/staticmap?center=%s&sensor=false&zoom=12&size=298x298" % urllib.quote_plus('%s, %s %s, %s' % (event.street, event.city, event.zip, event.country_id and event.country_id.name_get()[0][1] or ''))
})
return website.render("website_event.detail", values)

View File

@ -101,7 +101,7 @@
available.
</span>
</t>
<h4 class="media-heading"><a t-att-href="'/event/%%s' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
<h4 class="media-heading"><a t-att-href="'/event/%%s/' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
<a t-if="editable" href="#" t-att-data-id="event_id.id" class="pull-right">
<span t-att-class="'label label-success js_unpublish %%s' %% (not event_id.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (event_id.website_published and 'hidden' or '')">Click to Publish</span>
@ -149,8 +149,8 @@
<br/>
<t t-if="event_id.user_id">
Organized by: <span t-field="event_id.user_id"/><br/>
<span>&amp;#x2706; <span t-field="event_id.user_id.phone"></span></span><br/>
<i class="icon-envelope"></i> <span t-field="event_id.user_id.email"></span>
<span>&amp;#x2706; <span t-field="organizer.phone"></span></span><br/>
<i class="icon-envelope"></i> <span t-field="organizer.email"></span>
</t>
</address>
</div>
@ -166,13 +166,13 @@
available.
</span>
</t>
<h4 class="media-heading"><a t-att-href="'/event/%%s' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
<h4 class="media-heading"><a t-att-href="'/event/%%s/' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
<a t-if="editable" href="#" t-att-data-id="event_id.id" class="pull-right">
<span t-att-class="'label label-success js_unpublish %%s' %% (not event_id.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (event_id.website_published and 'hidden' or '')">Click to Publish</span>
</a>
<h4>Ticket Information</h4>
<form t-att-action="'/event/%%s/add_cart' %% event_id.id" method="post">
<h4 t-if="event_id.product_ids">Ticket Information</h4>
<form t-att-action="'/event/%%s/add_cart' %% event_id.id" method="post" t-if="event_id.product_ids">
<div t-foreach="event_id.product_ids" t-as="prod">
<span t-field="prod.product_id"/>
<span t-field="prod.price"/>