[FIX] website_event: pricelist in event register

Create an event with a price.
Create a pricelist with a different price for the event.
Add the pricelist to the Public user.
On the website, open the event to register.

Before this commit, the shown price is the one of the event, and not the
one of the pricelist.

Now, the price is shown correctly and take into account the pricelist.

opw-1951252

closes odoo/odoo#31848

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-03-14 12:46:01 +00:00
parent 9d3fed6d3f
commit c41d1d2ca8
+4 -1
View File
@@ -181,7 +181,10 @@ class WebsiteEventController(http.Controller):
def event_register(self, event, **post):
if not event.can_access_from_current_website():
raise werkzeug.exceptions.NotFound()
if not request.context.get('pricelist'):
pricelist = request.website.get_current_pricelist()
if pricelist:
event = event.with_context(pricelist=pricelist.id)
values = {
'event': event,
'main_object': event,