mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
add new function convert to convert a value to another currency
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from erpnext import get_company_currency, get_default_company
|
from erpnext import get_company_currency, get_default_company
|
||||||
|
from erpnext.setup.utils import get_exchange_rate
|
||||||
from frappe.utils import getdate, cstr, flt
|
from frappe.utils import getdate, cstr, flt
|
||||||
from frappe import _, _dict
|
from frappe import _, _dict
|
||||||
from erpnext.accounts.utils import get_account_currency
|
from erpnext.accounts.utils import get_account_currency
|
||||||
@@ -146,6 +147,12 @@ def get_currency(filters):
|
|||||||
return currency_map
|
return currency_map
|
||||||
|
|
||||||
|
|
||||||
|
def convert(value, from_, to, date):
|
||||||
|
rate = get_exchange_rate(from_, to, date)
|
||||||
|
converted_value = value / rate
|
||||||
|
return converted_value
|
||||||
|
|
||||||
|
|
||||||
def get_gl_entries(filters):
|
def get_gl_entries(filters):
|
||||||
currency = get_currency(filters)
|
currency = get_currency(filters)
|
||||||
select_fields = """, sum(debit_in_account_currency) as debit_in_account_currency,
|
select_fields = """, sum(debit_in_account_currency) as debit_in_account_currency,
|
||||||
|
|||||||
Reference in New Issue
Block a user