minor fix in landed cost voucher

This commit is contained in:
Nabin Hait 2015-05-13 12:53:11 +05:30
parent 7a9646959a
commit f6e4723101

View File

@ -70,6 +70,9 @@ class LandedCostVoucher(Document):
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)