Skip to content
Snippets Groups Projects
Commit 3a6e84d6 authored by Mahamadasif Ansari's avatar Mahamadasif Ansari
Browse files

[FIX] account_edi_ubl_cii: prevent ZeroDivisionError log error

A float division by zero error is generated on the log, and nothing
is imported from the file when the user uploads an XML file like
https://drive.google.com/file/d/1_eZYfqMk2kLtPsEjv-13DRHnmoXkWYeE

.
This is because here in LineID 1, there is a value billed quantity is 0.0,
a charge amount is 0.0, and a total amount is 100.0. This is wrong;
the total amount is always 0.0 when the billed quantity is 0.0
(billed quantity * charge amount).

This commit solves the above issue by dividing a price subtotal
by one when the billed quantity is zero.

sentry-4157357719

closes odoo/odoo#121027

Signed-off-by: default avatarQuentin De Paoli <qdp@odoo.com>
parent b61d2ae5
No related branches found
No related tags found
No related merge requests found
......@@ -594,7 +594,7 @@ class AccountEdiCommon(models.AbstractModel):
# for instance, when filling a down payment as an invoice line. The equation in the docstring is not
# respected, and the result will not be correct, so we just follow the simple rule below:
if net_price_unit == 0 and price_subtotal != net_price_unit * (billed_qty / basis_qty) - allow_charge_amount:
price_unit = price_subtotal / billed_qty
price_unit = price_subtotal / (billed_qty or 1)
return {
'quantity': quantity,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment