fix: ZeroDivisionError on creating e-invoice for credit note (#26915)

This commit is contained in:
Saqib 2021-08-12 16:26:51 +05:30 committed by GitHub
parent 54c31ed33c
commit 88f13fef81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,8 +190,10 @@ def get_item_list(invoice):
item.description = sanitize_for_json(d.item_name)
item.qty = abs(item.qty)
item.unit_rate = abs(item.taxable_value / item.qty)
if flt(item.qty) != 0.0:
item.unit_rate = abs(item.taxable_value / item.qty)
else:
item.unit_rate = abs(item.taxable_value)
item.gross_amount = abs(item.taxable_value)
item.taxable_value = abs(item.taxable_value)
item.discount_amount = 0