[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#122142 X-original-commit: 3a6e84d6733145f38184c473de4a1aa41464b1fa Signed-off-by: Quentin De Paoli <qdp@odoo.com> Signed-off-by: Ansari Mahamadasif (maan) <maan@odoo.com>
This commit is contained in:
@@ -623,7 +623,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,
|
||||
|
||||
Reference in New Issue
Block a user