From 18680990bf45015a806b3133d7fb1985f8e29914 Mon Sep 17 00:00:00 2001 From: GangaManoj Date: Fri, 27 Aug 2021 20:16:13 +0530 Subject: [PATCH] fix: Display Packed/Bundle Items table only if it exists --- .../doctype/pos_invoice/pos_invoice.json | 4 +++- .../doctype/sales_invoice/sales_invoice.json | 16 ++++++---------- .../doctype/purchase_order/purchase_order.json | 4 +++- erpnext/selling/doctype/quotation/quotation.json | 4 +++- .../selling/doctype/sales_order/sales_order.json | 4 +++- erpnext/selling/sales_common.js | 5 +---- .../doctype/delivery_note/delivery_note.json | 4 +++- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json index 19c6c8f3472..bff85872781 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json @@ -622,6 +622,7 @@ "read_only": 1 }, { + "depends_on": "packed_items", "fieldname": "packing_list", "fieldtype": "Section Break", "label": "Packing List", @@ -629,6 +630,7 @@ "print_hide": 1 }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "label": "Packed Items", @@ -1564,7 +1566,7 @@ "icon": "fa fa-file-text", "is_submittable": 1, "links": [], - "modified": "2021-08-24 18:19:20.728433", + "modified": "2021-08-27 20:12:57.306772", "modified_by": "Administrator", "module": "Accounts", "name": "POS Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 2f8de068840..48108a8271b 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -248,7 +248,7 @@ "depends_on": "customer", "fetch_from": "customer.customer_name", "fieldname": "customer_name", - "fieldtype": "Small Text", + "fieldtype": "Data", "hide_days": 1, "hide_seconds": 1, "in_global_search": 1, @@ -696,7 +696,6 @@ "hide_days": 1, "hide_seconds": 1, "label": "Scan Barcode", - "length": 1, "options": "Barcode" }, { @@ -728,6 +727,7 @@ "read_only": 1 }, { + "depends_on": "packed_items", "fieldname": "packing_list", "fieldtype": "Section Break", "hide_days": 1, @@ -737,6 +737,7 @@ "print_hide": 1 }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "hide_days": 1, @@ -1061,7 +1062,6 @@ "hide_days": 1, "hide_seconds": 1, "label": "Apply Additional Discount On", - "length": 15, "options": "\nGrand Total\nNet Total", "print_hide": 1 }, @@ -1148,7 +1148,7 @@ { "description": "In Words will be visible once you save the Sales Invoice.", "fieldname": "base_in_words", - "fieldtype": "Small Text", + "fieldtype": "Data", "hide_days": 1, "hide_seconds": 1, "label": "In Words (Company Currency)", @@ -1208,7 +1208,7 @@ }, { "fieldname": "in_words", - "fieldtype": "Small Text", + "fieldtype": "Data", "hide_days": 1, "hide_seconds": 1, "label": "In Words", @@ -1561,7 +1561,6 @@ "hide_days": 1, "hide_seconds": 1, "label": "Print Language", - "length": 6, "print_hide": 1, "read_only": 1 }, @@ -1649,7 +1648,6 @@ "hide_seconds": 1, "in_standard_filter": 1, "label": "Status", - "length": 30, "no_copy": 1, "options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nUnpaid and Discounted\nOverdue and Discounted\nOverdue\nCancelled\nInternal Transfer", "print_hide": 1, @@ -1709,7 +1707,6 @@ "hide_days": 1, "hide_seconds": 1, "label": "Is Opening Entry", - "length": 4, "oldfieldname": "is_opening", "oldfieldtype": "Select", "options": "No\nYes", @@ -1721,7 +1718,6 @@ "hide_days": 1, "hide_seconds": 1, "label": "C-Form Applicable", - "length": 4, "no_copy": 1, "options": "No\nYes", "print_hide": 1 @@ -2031,7 +2027,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2021-08-25 15:46:05.279588", + "modified": "2021-08-27 20:13:40.456462", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 3eee5066f1e..dd88c2d8507 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1141,6 +1141,7 @@ "options": "Tax Withholding Category" }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "label": "Bundle Items", @@ -1150,6 +1151,7 @@ { "collapsible": 1, "collapsible_depends_on": "packed_items", + "depends_on": "packed_items", "fieldname": "bundle_items_section", "fieldtype": "Section Break", "label": "Bundle Items", @@ -1161,7 +1163,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2021-08-27 20:05:54.869308", + "modified": "2021-08-27 20:11:23.509147", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 7185bb94de7..43a44900fcb 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -930,6 +930,7 @@ "read_only": 1 }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "label": "Bundle Items", @@ -939,6 +940,7 @@ { "collapsible": 1, "collapsible_depends_on": "packed_items", + "depends_on": "packed_items", "fieldname": "bundle_items_section", "fieldtype": "Section Break", "label": "Bundle Items", @@ -951,7 +953,7 @@ "is_submittable": 1, "links": [], "max_attachments": 1, - "modified": "2021-08-27 20:04:26.357378", + "modified": "2021-08-27 20:10:07.864951", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 6c4a4033ba4..212bbde123f 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -1019,6 +1019,7 @@ { "collapsible": 1, "collapsible_depends_on": "packed_items", + "depends_on": "packed_items", "fieldname": "packing_list", "fieldtype": "Section Break", "hide_days": 1, @@ -1029,6 +1030,7 @@ "print_hide": 1 }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "hide_days": 1, @@ -1511,7 +1513,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2021-08-27 02:45:54.968867", + "modified": "2021-08-27 20:11:57.748736", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 26ac630a32b..f05477ce23d 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -90,10 +90,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.toggle_display("customer_name", (this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer)); - if(this.frm.fields_dict.packed_items) { - var packing_list_exists = (this.frm.doc.packed_items || []).length; - this.frm.toggle_display("packing_list", packing_list_exists ? true : false); - } + this.toggle_editable_price_list_rate(); }, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 958189614fd..fdc8763baa6 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -543,6 +543,7 @@ { "collapsible": 1, "collapsible_depends_on": "packed_items", + "depends_on": "packed_items", "fieldname": "packing_list", "fieldtype": "Section Break", "label": "Packing List", @@ -551,6 +552,7 @@ "print_hide": 1 }, { + "depends_on": "packed_items", "fieldname": "packed_items", "fieldtype": "Table", "label": "Packed Items", @@ -1306,7 +1308,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2021-08-17 20:15:50.574966", + "modified": "2021-08-27 20:14:40.215231", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note",