diff --git a/modules/sale_credit_limit/party.py b/modules/sale_credit_limit/party.py index 9c7b1b3088..38a349728c 100644 --- a/modules/sale_credit_limit/party.py +++ b/modules/sale_credit_limit/party.py @@ -44,9 +44,13 @@ class Party(metaclass=PoolMeta): continue invoice = invoice_line.invoice if invoice and invoice.move: - quantity -= Uom.compute_qty( - invoice_line.unit, invoice_line.quantity, - line.unit, round=False) + if line.unit: + quantity -= Uom.compute_qty( + invoice_line.unit or line.unit, + invoice_line.quantity, + line.unit, round=False) + else: + quantity -= invoice_line.quantity if quantity > 0: amount += Currency.compute( sale.currency,