From e4e23836e78425eb2db27b993878989f12219168 Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Sun, 26 Apr 2020 13:06:55 +0530 Subject: [PATCH] mandatory depends on for cheque no and date, fix typo --- erpnext/accounts/doctype/journal_entry/journal_entry.js | 5 +---- erpnext/accounts/doctype/journal_entry/journal_entry.json | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index a6ef4942fb..0e5eee4186 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -122,12 +122,9 @@ frappe.ui.form.on("Journal Entry", { }, voucher_type: function(frm){ - frm.toggle_reqd("cheque_no", frm.doc.voucher_type=="Bank Entry"); - frm.toggle_reqd("cheque_date", frm.doc.voucher_type=="Bank Entry"); if(!frm.doc.company) return; - if(frm.) - + if((!(frm.doc.accounts || []).length) || ((frm.doc.accounts || []).length==1 && !frm.doc.accounts[0].account)) { if(in_list(["Bank Entry", "Cash Entry"], frm.doc.voucher_type)) { return frappe.call({ diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 2335109847..7892042bb9 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -159,6 +159,7 @@ "in_global_search": 1, "in_list_view": 1, "label": "Reference Number", + "mandatory_depends_on": "eval:doc.voucher_type == \"Bank Entry\"", "no_copy": 1, "oldfieldname": "cheque_no", "oldfieldtype": "Data", @@ -168,6 +169,7 @@ "fieldname": "cheque_date", "fieldtype": "Date", "label": "Reference Date", + "mandatory_depends_on": "eval:doc.voucher_type == \"Bank Entry\"", "no_copy": 1, "oldfieldname": "cheque_date", "oldfieldtype": "Date", @@ -501,7 +503,7 @@ "idx": 176, "is_submittable": 1, "links": [], - "modified": "2020-04-26 04:48:31.753820", + "modified": "2020-04-26 13:04:05.230155", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry",