mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
get the currencies from database rather than hardcoded
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.query_reports["General Ledger"] = {
|
||||
const get_currencies = () => {
|
||||
// frappe.db.get_list returns a Promise
|
||||
return frappe.db.get_list('GL Entry',
|
||||
{
|
||||
distinct: true,
|
||||
fields:['account_currency'],
|
||||
as_list: true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const flatten = (array) => {
|
||||
return [].concat.apply([], array);
|
||||
}
|
||||
|
||||
get_currencies()
|
||||
.then((r) => flatten(r))
|
||||
.then((currency_list) => {
|
||||
frappe.query_reports["General Ledger"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
@@ -110,7 +128,8 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldname": "presentation_currency",
|
||||
"label": __("Currency"),
|
||||
"fieldtype": "Select",
|
||||
"options": "NGN\nINR\nUSD"
|
||||
"options": currency_list
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user