frappe/frappe#478 removed self.doclist
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 12ecb09..59ce41f 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -182,12 +182,10 @@
"""
Validate that if packed qty exists, it should be equal to qty
"""
- if not any([flt(d.get('packed_qty')) for d in self.doclist if
- d.doctype=='Delivery Note Item']):
+ if not any([flt(d.get('packed_qty')) for d in self.get(self.fname)]):
return
packing_error_list = []
- for d in self.doclist:
- if d.doctype != 'Delivery Note Item': continue
+ for d in self.get(self.fname):
if flt(d.get('qty')) != flt(d.get('packed_qty')):
packing_error_list.append([
d.get('item_code', ''),
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index f10b338..54ac383 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -62,10 +62,13 @@
ch = self.append('uom_conversion_details', {})
ch.uom = self.stock_uom
ch.conversion_factor = 1
-
+
+ to_remove = []
for d in self.get("uom_conversion_details"):
if d.conversion_factor == 1 and d.uom != self.stock_uom:
- self.doclist.remove(d)
+ to_remove.append(d)
+
+ [self.remove(d) for d in to_remove]
def check_stock_uom_with_bin(self):
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index c4f69ac..1860983 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -24,8 +24,8 @@
self.validate_qty()
from erpnext.utilities.transaction_base import validate_uom_is_integer
- validate_uom_is_integer(self.doclist, "stock_uom", "qty")
- validate_uom_is_integer(self.doclist, "weight_uom", "net_weight")
+ validate_uom_is_integer(self, "stock_uom", "qty")
+ validate_uom_is_integer(self, "weight_uom", "net_weight")
def validate_delivery_note(self):
"""
@@ -104,7 +104,7 @@
group by item_code""" % ("%s", condition),
tuple([self.delivery_note] + rows), as_dict=1)
- ps_item_qty = dict([[d.item_code, d.qty] for d in self.doclist])
+ ps_item_qty = dict([[d.item_code, d.qty] for d in self.get("item_details")])
no_of_cases = cint(self.to_case_no) - cint(self.from_case_no) + 1
return res, ps_item_qty, no_of_cases
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 0999da0..1bcceaf 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -423,10 +423,7 @@
}
return ret
- def get_items(self):
- self.doclist = filter(lambda d: d.parentfield!="mtn_details", self.doclist)
- # self.set('mtn_details', [])
-
+ def get_items(self):
pro_obj = None
if self.production_order:
# common validations
diff --git a/erpnext/utilities/doctype/note/note.py b/erpnext/utilities/doctype/note/note.py
index a53313b..f0c7f0e 100644
--- a/erpnext/utilities/doctype/note/note.py
+++ b/erpnext/utilities/doctype/note/note.py
@@ -17,7 +17,7 @@
def onload(self):
if not self.public and frappe.session.user != self.owner:
- if frappe.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]:
+ if frappe.session.user not in [d.user for d in self.get("share_with")]:
frappe.msgprint("You are not authorized to read this record.", raise_exception=True)
def validate(self):
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index aa30b68..1934f4c 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -56,7 +56,7 @@
event_doclist.insert()
def validate_uom_is_integer(self, uom_field, qty_fields):
- validate_uom_is_integer(self.doclist, uom_field, qty_fields)
+ validate_uom_is_integer(self, uom_field, qty_fields)
def validate_with_previous_doc(self, source_dt, ref):
for key, val in ref.items():