[FIX] website_event_sale: pay the displayed price

The price displayed on the event page is the
`event.ticket`.`price_reduce` field,
which is basically the ticket price(`event.ticket`.`price`)
minus the possible discount applied by the pricelist

Nevertheless, the price asked when ordering the ticket,
in the cart/checkout, was the `ticket.price`,
without the possible discount from the pricelist, therefore.

The price asked for the ticket was therefore different than the price displayed.

To reproduce:
 1. Settings > Sales > Use pricelist
 2. Sales > Configuration > Pricelist > Public Pricelist > Apply a 20% discount (-0.2)
 3. Go to /event, -> Conference on Business Applications
 4. Order 1 of each
 5. Notice that the price asked is 800€ and 1200€ instead of 1000€ and 1500€ respectively
 6. Hit Order now -> Notice that the price in the cart are the price without the discount

opw-665540
This commit is contained in:
Denis Ledoux 2016-01-15 15:49:40 +01:00
parent b4debe9539
commit f9ee454d42
1 changed files with 3 additions and 2 deletions

View File

@ -34,14 +34,15 @@ class sale_order(osv.Model):
event_ticket_id = product.event_ticket_ids[0].id
if event_ticket_id:
ticket = self.pool.get('event.event.ticket').browse(cr, uid, event_ticket_id, context=context)
order = self.pool['sale.order'].browse(cr, SUPERUSER_ID, order_id, context=context)
ticket = self.pool.get('event.event.ticket').browse(cr, uid, event_ticket_id, context=dict(context, pricelist=order.pricelist_id.id))
if product_id != ticket.product_id.id:
raise osv.except_osv(_('Error!'),_("The ticket doesn't match with this product."))
values['product_id'] = ticket.product_id.id
values['event_id'] = ticket.event_id.id
values['event_ticket_id'] = ticket.id
values['price_unit'] = ticket.price
values['price_unit'] = ticket.price_reduce or ticket.price
values['name'] = "%s\n%s" % (ticket.event_id.display_name, ticket.name)
return values