fix in delivery note submission - error caused due to default packed qty

This commit is contained in:
Anand Doshi
2012-03-03 15:01:41 +05:30
parent c4e2d62333
commit 146f17bf57

View File

@@ -351,16 +351,17 @@ class DocType(TransactionBase):
""" """
Validate that if packed qty exists, it should be equal to qty Validate that if packed qty exists, it should be equal to qty
""" """
if not any([d.fields.get('packed_qty') for d in self.doclist]): if not any([flt(d.fields.get('packed_qty')) for d in self.doclist if
d.doctype=='Delivery Note Detail']):
return return
packing_error_list = [] packing_error_list = []
for d in self.doclist: for d in self.doclist:
if d.doctype != 'Delivery Note Detail': continue if d.doctype != 'Delivery Note Detail': continue
if d.fields.get('qty') != d.fields.get('packed_qty'): if flt(d.fields.get('qty')) != flt(d.fields.get('packed_qty')):
packing_error_list.append([ packing_error_list.append([
d.fields.get('item_code', ''), d.fields.get('item_code', ''),
d.fields.get('qty', ''), d.fields.get('qty', 0),
d.fields.get('packed_qty', '') d.fields.get('packed_qty', 0)
]) ])
if packing_error_list: if packing_error_list:
from webnotes.utils import cstr from webnotes.utils import cstr