From 5906ddf804ecdb16631746e9d6ddfa7cb6561a2a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 4 Aug 2017 10:52:01 +0530 Subject: [PATCH] [Fix] View ledger button not disaplying in the head of an account (#10254) * [Fix] View ledger button not disaplying in the head of an account * Show view ledger button in account if user has permission to read GL Entry data --- erpnext/accounts/doctype/account/account.js | 3 ++- .../accounts/doctype/gl_entry/gl_entry.json | 4 ++-- .../doctype/gl_entry/test_gl_entry.js | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 erpnext/accounts/doctype/gl_entry/test_gl_entry.js diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index ed7e39af22..ca46d6b0e5 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -68,7 +68,8 @@ frappe.ui.form.on('Account', { } }); }); - } else if (cint(frm.doc.is_group) == 0) { + } else if (cint(frm.doc.is_group) == 0 + && frappe.boot.user.can_read.indexOf("GL Entry") !== -1) { cur_frm.add_custom_button(__('Ledger'), function () { frappe.route_options = { "account": frm.doc.name, diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json index b1a41297f8..76e66d0906 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.json +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json @@ -718,7 +718,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-04-27 13:18:06.617940", + "modified": "2017-08-03 12:40:09.611951", "modified_by": "Administrator", "module": "Accounts", "name": "GL Entry", @@ -786,7 +786,7 @@ } ], "quick_entry": 1, - "read_only": 1, + "read_only": 0, "read_only_onload": 0, "search_fields": "voucher_no,account,posting_date,against_voucher", "show_name_in_global_search": 0, diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.js b/erpnext/accounts/doctype/gl_entry/test_gl_entry.js new file mode 100644 index 0000000000..2986e5e4e3 --- /dev/null +++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: GL Entry", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially('GL Entry', [ + // insert a new GL Entry + () => frappe.tests.make([ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +});