Removed account and party balance in company currency from Journal Entry
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index adf4c20..44acab5 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -29,8 +29,7 @@
})
erpnext.journal_entry.toggle_fields_based_on_currency = function(frm) {
- var fields = ["balance_in_account_currency", "party_balance_in_account_currency",
- "debit_in_account_currency", "credit_in_account_currency"];
+ var fields = ["debit_in_account_currency", "credit_in_account_currency"];
var company_currency = erpnext.get_currency(frm.doc.company);
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index c866181..85f4109 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -71,31 +71,8 @@
"no_copy": 1,
"oldfieldname": "balance",
"oldfieldtype": "Data",
- "options": "Company:company:default_currency",
- "permlevel": 0,
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "balance_in_account_currency",
- "fieldtype": "Currency",
- "hidden": 1,
- "ignore_user_permissions": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "label": "Balance in Account Currency",
- "no_copy": 1,
"options": "account_currency",
"permlevel": 0,
- "precision": "",
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
@@ -208,33 +185,10 @@
"in_list_view": 0,
"label": "Party Balance",
"no_copy": 0,
- "options": "Company:company:default_currency",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "read_only": 1,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "party_balance_in_account_currency",
- "fieldtype": "Currency",
- "hidden": 1,
- "ignore_user_permissions": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "label": "Party Balance in Account Currency",
- "no_copy": 1,
"options": "account_currency",
"permlevel": 0,
"precision": "",
- "print_hide": 1,
+ "print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -520,7 +474,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
- "modified": "2015-08-31 17:50:04.145031",
+ "modified": "2015-09-04 03:29:37.127968",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Account",
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 51c7916..f0f096e 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -50,7 +50,7 @@
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
@frappe.whitelist()
-def get_balance_on(account=None, date=None, party_type=None, party=None):
+def get_balance_on(account=None, date=None, party_type=None, party=None, in_account_currency=True):
if not account and frappe.form_dict.get("account"):
account = frappe.form_dict.get("account")
if not date and frappe.form_dict.get("date"):
@@ -102,10 +102,14 @@
(party_type.replace('"', '\\"'), party.replace('"', '\\"')))
if account or (party_type and party):
+ if in_account_currency:
+ select_field = "sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))"
+ else:
+ select_field = "sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))"
bal = frappe.db.sql("""
- SELECT sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
+ SELECT {0}
FROM `tabGL Entry` gle
- WHERE %s""" % " and ".join(cond))[0][0]
+ WHERE {1}""".format(select_field, " and ".join(cond)))[0][0]
# if bal is None, return 0
return flt(bal)
@@ -273,7 +277,7 @@
and name in (%s)""" % ', '.join(['%s']*len(account_list)), account_list))
for account, warehouse in account_warehouse.items():
- account_balance = get_balance_on(account, posting_date)
+ account_balance = get_balance_on(account, posting_date, in_account_currency=False)
stock_value = get_stock_value_on(warehouse, posting_date)
if abs(flt(stock_value) - flt(account_balance)) > 0.005:
difference.setdefault(account, flt(stock_value) - flt(account_balance))
@@ -378,7 +382,7 @@
# Balance as per system
stock_rbnb_account = "Stock Received But Not Billed - " + frappe.db.get_value("Company", company, "abbr")
- sys_bal = get_balance_on(stock_rbnb_account, posting_date)
+ sys_bal = get_balance_on(stock_rbnb_account, posting_date, in_account_currency=False)
# Amount should be credited
return flt(stock_rbnb) + flt(sys_bal)