From f6e47231016e4e61884f0f9b3b788279422c60b4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 13 May 2015 12:53:11 +0530 Subject: [PATCH] minor fix in landed cost voucher --- .../stock/doctype/landed_cost_voucher/landed_cost_voucher.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index 733821d982..221e4ebe81 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -69,6 +69,9 @@ class LandedCostVoucher(Document): def set_applicable_charges_for_item(self): based_on = self.distribute_charges_based_on.lower() total = sum([flt(d.get(based_on)) for d in self.get("items")]) + + if not total: + frappe.throw(_("Total {0} for all items is zero, may you should change 'Distribute Charges Based On'").format(based_on)) for item in self.get("items"): item.applicable_charges = flt(item.get(based_on)) * flt(self.total_taxes_and_charges) / flt(total)