From 086653b11e038ea8d5a1dfda7e320a09c49c5f2c Mon Sep 17 00:00:00 2001 From: Bruno Zanotti Date: Tue, 30 May 2023 07:50:34 -0300 Subject: [PATCH] [TMP FIX] not merge --- sale_stock_ux/models/sale_order_line.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sale_stock_ux/models/sale_order_line.py b/sale_stock_ux/models/sale_order_line.py index 7819a5af5..ef55b6382 100644 --- a/sale_stock_ux/models/sale_order_line.py +++ b/sale_stock_ux/models/sale_order_line.py @@ -5,7 +5,9 @@ from odoo import models, api, fields, _ from odoo.exceptions import UserError from odoo.tools.float_utils import float_compare +import logging +_logger = logging.getLogger(__name__) class SaleOrderLine(models.Model): _inherit = 'sale.order.line' @@ -163,8 +165,11 @@ def _compute_quantity_returned(self): r.location_dest_id.usage != "customer" and r.to_refund)) for move in return_moves: - quantity_returned += move.product_uom._compute_quantity( - move.product_uom_qty, order_line.product_uom) + try: + quantity_returned += move.product_uom._compute_quantity( + move.product_uom_qty, order_line.product_uom) + except Exception: + _logger.warning("Error trying to compute quantities in order: %s" % order_line.order_id.name) bom_enable = 'bom_ids' in self.env['product.template']._fields if bom_enable: boms = return_moves.mapped('bom_line_id.bom_id')