Sales/purchase return: fixes for qty validation

This commit is contained in:
Nabin Hait 2014-08-13 16:41:59 +05:30
parent 5145b1445b
commit 821aad5281

View File

@ -327,7 +327,7 @@ class StockEntry(StockController):
frappe.DoesNotExistError)
# validate quantity <= ref item's qty - qty already returned
ref_item_qty = sum([flt(d.qty) for d in ref.doc.get({"item_code": item.item_code})])
ref_item_qty = sum([flt(d.qty)*flt(d.conversion_factor) for d in ref.doc.get({"item_code": item.item_code})])
returnable_qty = ref_item_qty - flt(already_returned_item_qty.get(item.item_code))
if not returnable_qty:
frappe.throw(_("Item {0} has already been returned").format(item.item_code), StockOverReturnError)