diff --git a/patches/patch.py b/patches/patch.py index 8b7276b00dc..f6cf28889e1 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 340 +last_patch = 341 #------------------------------------------- @@ -1409,3 +1409,15 @@ def execute(patch_no): reload_doc('production','doctype','bill_of_materials') elif patch_no == 340: sql("update `tabDocField` set permlevel = 0 where (fieldname in ('process', 'production_order', 'fg_completed_qty') or label = 'Get Items') and parent = 'Stock Entry'") + elif patch_no == 341: + reload_doc('stock','doctype','delivery_note') + reload_doc('stock','doc_type','item') + reload_doc('selling','doc_type','quotation') + reload_doc('stock','Print Format','Delivery Note Packing List Wise') + + if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"): + from webnotes.model.doc import addchild + dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1) + ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1) + ch.format = 'Delivery Note Packing List Wise' + ch.save(1) diff --git a/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt b/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt new file mode 100644 index 00000000000..97f57a9f890 --- /dev/null +++ b/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt @@ -0,0 +1,27 @@ +# Print Format, Delivery Note Packing List Wise +[ + + # These values are common in all dictionaries + { + 'creation': '2011-08-18 16:29:14', + 'docstatus': 0, + 'modified': '2011-08-23 13:24:12', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all Print Format + { + 'doctype': 'Print Format', + 'html': "\n\n\n\n\n\n\n\n\n\n", + 'module': 'Stock', + 'name': '__common__', + 'standard': 'Yes' + }, + + # Print Format, Delivery Note Packing List Wise + { + 'doctype': 'Print Format', + 'name': 'Delivery Note Packing List Wise' + } +] \ No newline at end of file diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py index 2a2900fccf4..e5acd163a75 100644 --- a/stock/doctype/delivery_note/delivery_note.py +++ b/stock/doctype/delivery_note/delivery_note.py @@ -174,6 +174,9 @@ class DocType(TransactionBase): self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total) self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export) + # ::::::: Set Net Weight of each Packing + self.update_pack_nett_weight() + self.print_packing_slip() # ::::::: Set actual qty for each item in selected warehouse ::::::: self.update_current_stock() # :::::: set DN status ::::::: @@ -182,7 +185,6 @@ class DocType(TransactionBase): if not self.doc.billing_status: self.doc.billing_status = 'Not Billed' if not self.doc.installation_status: self.doc.installation_status = 'Not Installed' - # ************** Validate Mandatory ************************* def validate_mandatory(self): # :::::::::: Amendment Date :::::::::::::: @@ -439,4 +441,41 @@ class DocType(TransactionBase): # Packing Slip Related # ========================================== - #def get \ No newline at end of file + def update_pack_nett_weight(self): + for d in getlist(self.doclist, 'delivery_note_details'): + if d.item_name: + item_wt = sql("select nett_weight from `tabItem` where item_name = '%s'" % (d.item_name)) + d.pack_nett_wt = item_wt and flt(item_wt[0][0])*flt(d.qty) 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:#Footer goes here + html+='
CASE NO'+cstr(d.pack_no)+'NETT WT'+cstr(tot_nett_wt)+'CHECKED BY
SIZEGROSS 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.pack_no)+'
' + html+='' + sno=0 + tot_nett_wt,to_gross_wt=flt(d.pack_nett_wt),flt(d.pack_gross_wt) + #Body code goes here + html+='' + prev_pack=d.pack_no + tot_nett_wt+=flt(d.pack_nett_wt) + tot_gross_wt+=flt(d.pack_gross_wt) + html+='' + self.doc.print_packing_slip=html + + + + + + + + + diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt index 3ec4b383bc5..1ab19e070c9 100644 --- a/stock/doctype/delivery_note/delivery_note.txt +++ b/stock/doctype/delivery_note/delivery_note.txt @@ -5,7 +5,7 @@ { 'creation': '2011-04-18 15:58:20', 'docstatus': 0, - 'modified': '2011-08-18 16:31:02', + 'modified': '2011-08-23 15:26:57', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -21,7 +21,7 @@ # These values are common for all DocType { - '_last_update': '1313485457', + '_last_update': '1313665263', 'colour': 'White:FFF', 'doctype': 'DocType', 'document_type': 'Transaction', @@ -36,12 +36,13 @@ 'show_in_menu': 0, 'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed', 'tag_fields': 'billing_status', - 'version': 447 + 'version': 449 }, # These values are common for all DocFormat { 'doctype': 'DocFormat', + 'format': 'Delivery Note Packing List Wise', 'name': '__common__', 'parent': 'Delivery Note', 'parentfield': 'formats', @@ -135,14 +136,12 @@ # DocFormat { 'doctype': 'DocFormat', - 'format': 'Delivery Note Format', 'idx': 1 }, # DocFormat { 'doctype': 'DocFormat', - 'format': 'Delivery Note Packing List Wise', 'idx': 2 }, @@ -1481,5 +1480,18 @@ 'options': 'repair_delivery_note', 'permlevel': 0, 'print_hide': 1 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'print_packing_slip', + 'fieldtype': 'Text', + 'hidden': 1, + 'idx': 95, + 'in_filter': 0, + 'label': 'Print Packing Slip', + 'permlevel': 0, + 'print_hide': 0 } ] \ No newline at end of file
S.NO.QUANTITYCS.NO.DESCRIPTIONWEIGHT
'+cstr(sno+1)+''+cstr(d.qty)+''+d.item_code+''+cstr(d.pack_nett_wt)+'