mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +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
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// 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": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"company",
|
"fieldname":"company",
|
||||||
@@ -110,7 +128,8 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
"fieldname": "presentation_currency",
|
"fieldname": "presentation_currency",
|
||||||
"label": __("Currency"),
|
"label": __("Currency"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": "NGN\nINR\nUSD"
|
"options": currency_list
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user