Merge pull request #18045 from deepeshgarg007/accounts_controller_develop

fix: Float division by zero error handling in group similar item
This commit is contained in:
rohitwaghchaure 2019-06-25 15:25:42 +05:30 committed by GitHub
commit f9de144f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -778,7 +778,12 @@ class AccountsController(TransactionBase):
count += 1
item.qty = group_item_qty[item.item_code]
item.amount = group_item_amount[item.item_code]
item.rate = flt(flt(item.amount) / flt(item.qty), item.precision("rate"))
if item.qty:
item.rate = flt(flt(item.amount) / flt(item.qty), item.precision("rate"))
else:
item.rate = 0
item.idx = count
del group_item_qty[item.item_code]
else: