From 264f4b708a0115d8ccab1fe714b2c454b2aa07f6 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 1 Oct 2020 16:21:28 +0000 Subject: [PATCH] [FIX] website_event_sale: sell non-event tickets - Create a ticket product. - Add it to an event. - Uncheck it as ticket. - Sell it on the website. A traceback is raised here: https://github.com/odoo/odoo/blob/88e32c5af9f47981bebea560de456a1404b4e382/addons/website_event_sale/models/sale_order.py#L88 It happens because a ticket is found, but `new_qty` is a `string` while while `old_qty` is a `float`. It is coming from `add_qty` which is a `string` while a `float` is expected. We apply the same logic than: https://github.com/odoo/odoo/blob/88e32c5af9f47981bebea560de456a1404b4e382/addons/website_sale/models/sale_order.py#L181-L190 opw-2347633 closes odoo/odoo#59216 X-original-commit: 859ffdbc3a80f50be9e298c0b5e86cd58eca0d89 Signed-off-by: Nicolas Martinelli (nim) --- addons/website_event_sale/models/sale_order.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/website_event_sale/models/sale_order.py b/addons/website_event_sale/models/sale_order.py index d092b751366..296738c6925 100644 --- a/addons/website_event_sale/models/sale_order.py +++ b/addons/website_event_sale/models/sale_order.py @@ -53,6 +53,17 @@ class SaleOrder(models.Model): def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs): OrderLine = self.env['sale.order.line'] + try: + if add_qty: + add_qty = float(add_qty) + except ValueError: + add_qty = 1 + try: + if set_qty: + set_qty = float(set_qty) + except ValueError: + set_qty = 0 + if line_id: line = OrderLine.browse(line_id) ticket = line.event_ticket_id