Report presentation currency (#12670)

* Add new Select to filters

* get the currencies from database rather than hardcoded

* label report columns:
- If presentation currency is available in filters, use it or
- If company is available in filters, use it or
- use default company currency

* add new function - get_currency

* tweak new function `get_currency`

* add new function `convert` to convert a value to another currency

* add new function `convert_to_presentation_currency`

* clean up `get_currency` first pass

* memoise the exchange rates

* limit fetched GL entries to to_date

* check if account type is p&l or not and use appropriate exchange rate based on that

* change EXCHANGE RATE to a dict, use for memoisation

* rename EXCHANGE_RATE

* cache exchange rates and use them as needed

* add docstrings

* add presentation currency logic to financial statement reports

* move new functions from `general_ledger.py` to new module

* clean up

* PEP 8 clean up

* move function to util.py

* PEP 8 clean up

* remove presentation currency option from cashflow

* adjust currency as needed

* allow users to save presentation currency in Accounts Settings

* add new function `get_presentation_currency_list`

* refactor query_report modules with no promises

* Revert "allow users to save presentation currency in Accounts Settings"

This reverts commit 3b58a6296c.

* show print page in correct currency

* Update utils.py
This commit is contained in:
tundebabzy
2018-02-12 10:34:50 +01:00
committed by Nabin Hait
parent 621740efd9
commit c89782502c
10 changed files with 279 additions and 101 deletions

View File

@@ -13,6 +13,12 @@ $.extend(erpnext, {
return frappe.boot.sysdefaults.currency;
},
get_presentation_currency_list: () => {
const docs = frappe.boot.docs;
const currency_list = docs.filter(d => d.doctype === ":Currency").map(d => d.name);
return currency_list;
},
toggle_naming_series: function() {
if(cur_frm.fields_dict.naming_series) {
cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);