[FIX] website_event_sale: event discount

Fine-tuning 180866fe1e

- Go to Sales > Configuration > Settings
- Enable "Multiple Sales Prices per Product" and select option "Prices
computed from formulas (discounts, margins, roundings)"
- Go to Sales > Catalog / Pricelists
- Select "Public Pricelist" and set "Discount Policy: Show public price
& discount to the customer"
- Add a discount to an event (20 % to "Open Days in Los Angeles" for
example)
- Go to the eCommerce, buy a ticket to "Open Days in Los Angeles" which
as a 20 % discount

Since 180866fe1e the discount is applied
two times.

opw-2058709

closes odoo/odoo#36106

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-08-27 08:33:30 +00:00
parent a20b84d05a
commit 61ad8a9ea7
@@ -41,7 +41,10 @@ class SaleOrder(models.Model):
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_reduce
if order.pricelist_id.discount_policy == 'without_discount':
values['price_unit'] = ticket.price
else:
values['price_unit'] = ticket.price_reduce
values['name'] = "%s\n%s" % (ticket.event_id.display_name, ticket.name)
# avoid writing related values that end up locking the product record