[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
This commit is contained in:
rohitwaghchaure 2017-08-04 10:52:01 +05:30 committed by Makarand Bauskar
parent 1696294847
commit 5906ddf804
3 changed files with 27 additions and 3 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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()
]);
});