[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) <nim@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user