From c4a54fe24e40de1f6ada6644471718a7c9cd3f9e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 18:19:51 +0530 Subject: [PATCH] [usability] [issue] webnotes/erpnext#346 - hide packing list if it is empty --- selling/doctype/sales_common/sales_common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 0f19fa2f02..e59a7474f9 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -121,10 +121,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }, - refresh: function(doc) { + refresh: function() { + this._super(); this.frm.toggle_display("customer_name", (this.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer)); - this._super(); + if(this.frm.fields_dict.packing_details) { + var packing_list_exists = this.frm.get_doclist({parentfield: "packing_details"}).length; + this.frm.toggle_display("packing_list", packing_list_exists ? true : false); + } }, customer: function() {