[IMP] website_event, event

bzr revid: chm@openerp.com-20130806130053-wt1l25ri50c1z0e6
This commit is contained in:
Christophe Matthieu 2013-08-06 15:00:53 +02:00
parent 1e5794ac01
commit ca54d94534
6 changed files with 32 additions and 40 deletions

View File

@ -203,7 +203,7 @@ class event_event(osv.osv):
'email_confirmation_id' : fields.many2one('email.template','Event Confirmation Email', help="If you set an email template, each participant will receive this email announcing the confirmation of the event."),
'reply_to': fields.char('Reply-To Email', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address of the organizer is likely to be put here, with the effect to be in the 'Reply-To' of the mails sent automatically at event or registrations confirmation. You can also put the email address of your mail gateway if you use one."),
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who will be giving speech at the event."),
'address_id': fields.many2one('res.partner','Location Address', readonly=False, states={'done': [('readonly', True)]}),
'address_id': fields.many2one('res.partner','Location', readonly=False, states={'done': [('readonly', True)]}),
'street': fields.related('address_id','street',type='char',string='Street'),
'street2': fields.related('address_id','street2',type='char',string='Street2'),
'state_id': fields.related('address_id','state_id',type='many2one', relation="res.country.state", string='State'),

View File

@ -80,18 +80,7 @@
</div>
<group>
<group>
<label for="address_id" string="Location"/>
<div>
<field name="address_id" on_change="on_change_address_id(address_id)" />
<field name="street" placeholder="Street..."/>
<field name="street2"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": true}'/>
<field name="zip" placeholder="ZIP" style="width: 20%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": true}'/>
</div>
<field name="address_id" on_change="on_change_address_id(address_id)" context="{'show_address': 1}" options='{"always_reload": True}'/>
</group>
<group>
<field name="user_id"/>

View File

@ -8,7 +8,7 @@ OpenERP Blog
""",
'author': 'OpenERP SA',
'depends': ['website', 'event', 'website_sale'],
'depends': ['website', 'event_sale', 'website_sale'],
'data': [
'views/website_event.xml',
'security/ir.model.access.csv',

View File

@ -66,7 +66,6 @@ class website_event(http.Controller):
for key, search in domain_search.items():
if key != without:
domain += search
print domain
return domain
# count by domains without self search
@ -97,12 +96,9 @@ class website_event(http.Controller):
@http.route(['/event/<int:event_id>'], type='http', auth="public")
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
event = request.registry['event.event'].browse(request.cr, request.uid, event_id, {'show_address': 1})
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

@ -9,14 +9,18 @@ class event(osv.osv):
'website_published': fields.boolean('Available in the website'),
'description_website': fields.html('Description for the website'),
'product_ids': fields.one2many('event.event.product', "event_id", "Event"),
'organizer_id': fields.many2one('res.partner', "Orgonizer"),
'phone': fields.related('orgonizer_id', 'phone', type='char', string='Phone'),
'email': fields.related('orgonizer_id', 'email', type='char', string='Email'),
}
class event_product(osv.osv):
_name = 'event.event.product'
_columns = {
'deadline': fields.date("Sales End"),
'event_id': fields.many2one('event.event', "Event"),
'product_id': fields.many2one('product.product', 'Product'),
'product_id': fields.many2one('product.product', 'Product', domain=[("event_type_id", "!=", False)]),
'price': fields.float('Price'),
'qty': fields.integer('Current Registrations', readonly=True),
'max_qty': fields.integer('Maximum Registrations'),

View File

@ -10,17 +10,19 @@
<data>
<xpath expr="//notebook" position="inside">
<page string="Tarifs">
<group colspan="4">
<field name="product_ids">
<tree string="Payments" editable="top">
<field name="product_id"/>
<field name="price"/>
<field name="max_qty"/>
</tree>
</field>
</group>
<field name="product_ids">
<tree string="Payments" editable="bottom">
<field name="product_id"/>
<field name="deadline"/>
<field name="price"/>
<field name="max_qty"/>
</tree>
</field>
</page>
</xpath>
<field name="address_id" position="after">
<field name="organizer_id"/>
</field>
</data>
</field>
</record>
@ -73,7 +75,7 @@
<ul class="nav nav-list">
<li class="nav-header">Category</li>
<t t-foreach="types">
<li t-if="type" t-att-class="searches.get('type') == str(type[0]) and 'active' or ''">
<li t-if="type" t-att-class="searches.get('type') == str(type and type[0]) and 'active' or ''">
<a t-att-href="'/event/%%s&amp;type=%%s' %% (search_path, type[0])"><t t-esc="type[1]"/> <small>(<t t-esc="type_count"/>)</small></a>
</li>
</t>
@ -81,7 +83,7 @@
<ul class="nav nav-list">
<li class="nav-header">Location</li>
<t t-foreach="countries">
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id[0]) and 'active' or ''">
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
<a t-att-href="'/event/%%s&amp;country=%%s' %% (search_path, country_id[0])"><t t-esc="country_id[1]"/><small>(<t t-esc="country_id_count"/>)</small></a>
</li>
</t>
@ -140,17 +142,12 @@
<h4>When &amp; Where</h4>
<img t-att-src="google_map_url"/>
<address>
<h4 t-field="event_id.address_id">Name</h4><br/>
<span t-field="event_id.street"/><br/>
<span t-field="event_id.city"/>, <span t-field="event_id.zip"/><br/>
<span t-field="event_id.country_id"> </span><br/>
<pre t-field="event_id.address_id"/>
<i class="icon-time"></i> <span t-field="event_id.date_begin"> </span><br/>
<i class="icon-time"></i> <span t-field="event_id.date_end"> </span><br/>
<br/>
<i class="icon-time"></i> <span t-field="event_id.date_end"> </span>
<t t-if="event_id.user_id">
Organized by: <span t-field="event_id.user_id"/><br/>
<span>&amp;#x2706; <span t-field="organizer.phone"></span></span><br/>
<i class="icon-envelope"></i> <span t-field="organizer.email"></span>
<h6>Organized by:</h6>
<pre><t t-field="event_id.organizer_id"/><br/><span>&amp;#x2706;</span> <span t-field="event_id.phone"></span><br/><i class="icon-envelope"></i> <span t-field="event_id.email"></span></pre>
</t>
</address>
</div>
@ -167,6 +164,11 @@
</span>
</t>
<h4 class="media-heading"><a t-att-href="'/event/%%s/' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
<h5 class="media-heading">
<span t-field="event_id.address_id"/><br/>
<i class="icon-time"></i> <span t-field="event_id.date_begin"/><br/>
<i class="icon-time"></i> <span t-field="event_id.date_end"/>
</h5>
<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>
@ -175,6 +177,7 @@
<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.deadline"/>
<span t-field="prod.price"/>
<span t-field="prod.qty"/>
<span t-field="prod.max_qty"/>