Merge pull request #5264 from neilLasrado/hotfix

Fixed Currency Symbol in Trial Balance and Trial Balance for Party re…
This commit is contained in:
Anand Doshi 2016-04-27 12:32:05 +05:30
commit c6479bcbb6
2 changed files with 37 additions and 3 deletions

View File

@ -161,6 +161,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
def prepare_data(accounts, filters, total_row, parent_children_map): def prepare_data(accounts, filters, total_row, parent_children_map):
data = [] data = []
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
for d in accounts: for d in accounts:
has_value = False has_value = False
row = { row = {
@ -169,7 +171,8 @@ def prepare_data(accounts, filters, total_row, parent_children_map):
"parent_account": d.parent_account, "parent_account": d.parent_account,
"indent": d.indent, "indent": d.indent,
"from_date": filters.from_date, "from_date": filters.from_date,
"to_date": filters.to_date "to_date": filters.to_date,
"currency": company_currency
} }
prepare_opening_and_closing(d) prepare_opening_and_closing(d)
@ -201,37 +204,50 @@ def get_columns():
"fieldname": "opening_debit", "fieldname": "opening_debit",
"label": _("Opening (Dr)"), "label": _("Opening (Dr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "opening_credit", "fieldname": "opening_credit",
"label": _("Opening (Cr)"), "label": _("Opening (Cr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "debit", "fieldname": "debit",
"label": _("Debit"), "label": _("Debit"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "credit", "fieldname": "credit",
"label": _("Credit"), "label": _("Credit"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "closing_debit", "fieldname": "closing_debit",
"label": _("Closing (Dr)"), "label": _("Closing (Dr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "closing_credit", "fieldname": "closing_credit",
"label": _("Closing (Cr)"), "label": _("Closing (Cr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
},
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Link",
"options": "Currency",
"hidden": 1
} }
] ]

View File

@ -21,7 +21,7 @@ def execute(filters=None):
def get_data(filters, show_party_name): def get_data(filters, show_party_name):
party_name_field = "customer_name" if filters.get("party_type")=="Customer" else "supplier_name" party_name_field = "customer_name" if filters.get("party_type")=="Customer" else "supplier_name"
parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], order_by="name") parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], order_by="name")
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
opening_balances = get_opening_balances(filters) opening_balances = get_opening_balances(filters)
balances_within_period = get_balances_within_period(filters) balances_within_period = get_balances_within_period(filters)
@ -57,6 +57,10 @@ def get_data(filters, show_party_name):
"closing_credit": closing_credit "closing_credit": closing_credit
}) })
row.update({
"currency": company_currency
})
has_value = False has_value = False
if (opening_debit or opening_credit or debit or credit or closing_debit or closing_credit): if (opening_debit or opening_credit or debit or credit or closing_debit or closing_credit):
has_value =True has_value =True
@ -69,7 +73,8 @@ def get_data(filters, show_party_name):
data.append({ data.append({
"party": "'" + _("Totals") + "'", "party": "'" + _("Totals") + "'",
"debit": total_debit, "debit": total_debit,
"credit": total_credit "credit": total_credit,
"currency": company_currency
}) })
return data return data
@ -138,37 +143,50 @@ def get_columns(filters, show_party_name):
"fieldname": "opening_debit", "fieldname": "opening_debit",
"label": _("Opening (Dr)"), "label": _("Opening (Dr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "opening_credit", "fieldname": "opening_credit",
"label": _("Opening (Cr)"), "label": _("Opening (Cr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "debit", "fieldname": "debit",
"label": _("Debit"), "label": _("Debit"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "credit", "fieldname": "credit",
"label": _("Credit"), "label": _("Credit"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "closing_debit", "fieldname": "closing_debit",
"label": _("Closing (Dr)"), "label": _("Closing (Dr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
}, },
{ {
"fieldname": "closing_credit", "fieldname": "closing_credit",
"label": _("Closing (Cr)"), "label": _("Closing (Cr)"),
"fieldtype": "Currency", "fieldtype": "Currency",
"options": "currency",
"width": 120 "width": 120
},
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Link",
"options": "Currency",
"hidden": 1
} }
] ]