[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
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index ed7e39a..ca46d6b0 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -68,7 +68,8 @@
}
});
});
- } 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 b1a4129..76e66d0 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 0000000..2986e5e
--- /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()
+ ]);
+
+});