Skip to content

Commit

Permalink
[FIX] website_event,website_event_sale: correction pricelist in event…
Browse files Browse the repository at this point in the history
… register

A recent fix c41d1d2 was made to select the related pricelist
to show the correct price of an event product.

This fix creates another bug in case of Ecommerce app
not installed, because the method get_current_pricelist
is defined in website_sale module.

We need to move the fix from website_event to website_event_sale module.

closes #31953

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
  • Loading branch information
alt-odoo committed Mar 19, 2019
1 parent 577333f commit f7acbf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions addons/website_event/controllers/main.py
Expand Up @@ -181,10 +181,7 @@ def event(self, event, **post):
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,
Expand Down
4 changes: 4 additions & 0 deletions addons/website_event_sale/controllers/main.py
Expand Up @@ -11,6 +11,10 @@ class WebsiteEventSaleController(WebsiteEventController):
@http.route()
def event_register(self, event, **post):
event = event.with_context(pricelist=request.website.id)
if not request.context.get('pricelist'):
pricelist = request.website.get_current_pricelist()
if pricelist:
event = event.with_context(pricelist=pricelist.id)
return super(WebsiteEventSaleController, self).event_register(event, **post)

def _process_tickets_details(self, data):
Expand Down

0 comments on commit f7acbf6

Please sign in to comment.