diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-08-06 15:00:53 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-08-06 15:00:53 +0200 |
| commit | ca54d94534089f3bf9f4b958d8564609c1ee9f49 (patch) | |
| tree | 9cc62073f0eda83fab7a606623d761101d5491eb /addons/website_event | |
| parent | 1e5794ac01a7cc3cf2a9b4678d00923d9c0b4921 (diff) | |
[IMP] website_event, event
bzr revid: chm@openerp.com-20130806130053-wt1l25ri50c1z0e6
Diffstat (limited to 'addons/website_event')
| -rw-r--r-- | addons/website_event/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/website_event/controllers/main.py | 6 | ||||
| -rw-r--r-- | addons/website_event/event.py | 6 | ||||
| -rw-r--r-- | addons/website_event/views/website_event.xml | 43 |
4 files changed, 30 insertions, 27 deletions
diff --git a/addons/website_event/__openerp__.py b/addons/website_event/__openerp__.py index ad615c092d8..100175e6eee 100644 --- a/addons/website_event/__openerp__.py +++ b/addons/website_event/__openerp__.py @@ -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', diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 3c7c10f0a13..33fbe3730bc 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -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) diff --git a/addons/website_event/event.py b/addons/website_event/event.py index 72ad35a4210..047e492153f 100644 --- a/addons/website_event/event.py +++ b/addons/website_event/event.py @@ -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'), diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index a1797e1ebcb..6115491429c 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -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&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&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 & 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>&#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>&#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"/> |
