From a1f477ec543cfa4d963f4d95e9dfda706faa0233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 29 Nov 2024 14:12:01 +0100 Subject: [PATCH] Do not convert invoiced quantity if sale has not unit when computing credit amount Closes #13715 (grafted from a544d1b5b342dde5f2ace14eab375dd7f0a63b6a) --HG-- branch : 7.0 --- modules/sale_credit_limit/party.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/sale_credit_limit/party.py b/modules/sale_credit_limit/party.py index ea452e878e..42790257f8 100644 --- a/modules/sale_credit_limit/party.py +++ b/modules/sale_credit_limit/party.py @@ -40,9 +40,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,