diff --git a/erpnext/patches/packing_slip.py b/erpnext/patches/packing_slip.py
new file mode 100644
index 00000000000..b6c94c040f2
--- /dev/null
+++ b/erpnext/patches/packing_slip.py
@@ -0,0 +1,7 @@
+def execute():
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('stock', 'doctype', 'delivery_note_detail')
+ reload_doc('stock', 'Print Format', 'Delivery Note Packing List Wise')
+
+ webnotes.conn.sql("delete from `tabDocField` where fieldname in ('packed_by', 'packing_checked_by', 'pack_size') and parent = 'Delivery Note'")
+
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index b49f80c6567..ea8c648b748 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -443,33 +443,80 @@ class DocType(TransactionBase):
# ==========================================
def update_pack_nett_weight(self):
for d in getlist(self.doclist, 'delivery_note_details'):
- if d.item_code:
+ if d.item_code and not d.pack_nett_wt:
item_wt = sql("select nett_weight from `tabItem` where name = %s", (d.item_code))
d.pack_nett_wt = item_wt and flt(item_wt[0][0]) or 0
- # ==========================================
- def print_packing_slip(self):
- prev_pack='0'
- sno=0
- html=''
- tot_nett_wt,tot_gross_wt=0,0
- for d in getlist(self.doclist, 'delivery_note_details'):
- sno=sno+1
- if sno!=1 and prev_pack!=d.pack_no:#Footer goes here
- html+='
| CASE NO | '+cstr(d.pack_no)+' | NETT WT | '+cstr(tot_nett_wt)+' | CHECKED BY | |
| SIZE | | GROSS WT | '+cstr(tot_gross_wt)+' | PACKED BY | |
'
- if prev_pack!=d.pack_no: #Prepare Header Here
- #Header code goes here
- html+='[HEADER GOES HERE]
Packing Slip
| Order No. | '+cstr(self.doc.sales_order_no)+' | Shipping Marks | '+cstr(d.shipping_mark)+' |
'
- html+='| S.NO. | QUANTITY | CS.NO. | DESCRIPTION | WEIGHT |
'
- sno=0
- tot_nett_wt,to_gross_wt=flt(d.pack_nett_wt),flt(d.pack_gross_wt)
- #Body code goes here
- html+='
| '+cstr(sno+1)+' | '+cstr(d.qty)+' | '+d.item_code+' | '+d.description+' | '+cstr(d.pack_nett_wt)+' |
'
- prev_pack=d.pack_no
- tot_nett_wt+=flt(d.pack_nett_wt)
- tot_gross_wt+=flt(d.pack_gross_wt)
- if html!='':
- html+='
| CASE NO | '+cstr(d.pack_no)+' | NETT WT | '+cstr(tot_nett_wt)+' | CHECKED BY | '+cstr(self.doc.packing_checked_by)+' |
| SIZE | '+cstr(self.doc.pack_size)+' | GROSS WT | '+cstr(tot_gross_wt)+' | PACKED BY | '+cstr(self.doc.packed_by)+' |
'
- html+='