fix: Divide by zero exception handling

This commit is contained in:
deepeshgarg007 2019-04-03 09:11:03 +05:30
parent b035bf7f39
commit 5ad7b655cf

View File

@ -54,8 +54,10 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom
] ]
row += [(d.base_net_rate * d.qty)/d.stock_qty, d.base_net_amount] \ if d.stock_uom != d.uom and d.stock_qty:
if d.stock_uom != d.uom and d.stock_qty != 0 else [d.base_net_rate, d.base_net_amount] row += [(d.base_net_rate * d.qty)/d.stock_qty, d.base_net_amount]
else:
row += [d.base_net_rate, d.base_net_amount]
total_tax = 0 total_tax = 0
for tax in tax_columns: for tax in tax_columns: