[Fix] Packing Slip creation if custom field does not have a value (#11423)
* [Fix] Packing Slip creation if custom field is Column/Section Break
* Used no_value_fields and sorted imports
* Update packing_slip.py
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index 25fde08..ec5392f 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, cint
-from frappe import _
+import frappe
+from frappe import _
+from frappe.model import no_value_fields
from frappe.model.document import Document
+from frappe.utils import cint, flt
+
class PackingSlip(Document):
@@ -84,11 +86,12 @@
* No. of Cases of this packing slip
"""
- # also pick custom fields from delivery note
rows = [d.item_code for d in self.get("items")]
- custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname) for d in \
- frappe.get_meta("Delivery Note Item").get_custom_fields()])
+ # also pick custom fields from delivery note
+ custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname)
+ for d in frappe.get_meta("Delivery Note Item").get_custom_fields()
+ if d.fieldtype not in no_value_fields])
if custom_fields:
custom_fields = ', ' + custom_fields