From ce8ffec2f91ec8353455b06bfb1714529fea94a5 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 10 Oct 2023 17:28:45 +0200 Subject: [PATCH] [FIX] account_edi_ubl_cii: traceback on billed_qty 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try to Upload a Vendor Bill xml having an invoice line with billed_qty 0 Issue: Traceback caused by ZeroDivisionError opw-3497841 closes odoo/odoo#138843 X-original-commit: 0b3387390539e7379f1794c16f8ebf59fd4af9f8 Signed-off-by: de Wouters de Bouchout Jean-BenoƮt (jbw) Signed-off-by: Andrea Grazioso (agr) --- addons/account_edi_ubl_cii/models/account_edi_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_edi_ubl_cii/models/account_edi_common.py b/addons/account_edi_ubl_cii/models/account_edi_common.py index 4b9e78d914f..7dc58e54f40 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_common.py +++ b/addons/account_edi_ubl_cii/models/account_edi_common.py @@ -599,7 +599,7 @@ class AccountEdiCommon(models.AbstractModel): elif net_price_unit is not None: price_unit = (net_price_unit + rebate) / basis_qty elif price_subtotal is not None: - price_unit = (price_subtotal + allow_charge_amount) / billed_qty + price_unit = (price_subtotal + allow_charge_amount) / (billed_qty or 1) else: raise UserError(_("No gross price, net price nor line subtotal amount found for line in xml"))