diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 69c88ed3c4..712d35b38e 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -37,9 +37,12 @@
{%= data[i][__("Voucher No")] %} {%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %} - {%= format_currency(data[i][__("Invoiced Amount")]) %} - {%= format_currency(data[i][__("Paid Amount")]) %} - {%= format_currency(data[i][__("Outstanding Amount")]) %} + + {%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %} + + {%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %} + + {%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %} {% } else { %} diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 39fe5c4ba7..365212a163 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -58,21 +58,19 @@ class ReceivablePayableReport(object): "width": 120 }) + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 100 + }) if args.get("party_type") == "Customer": columns += [_("Territory") + ":Link/Territory:80"] if args.get("party_type") == "Supplier": columns += [_("Supplier Type") + ":Link/Supplier Type:80"] - columns += [ - { - "fieldname": "currency", - "label": _("Currency"), - "fieldtype": "Data", - "width": 100, - "hidden": 1 - }, - _("Remarks") + "::200" - ] - + + columns.append(_("Remarks") + "::200") + return columns def get_data(self, party_naming_by, args): @@ -120,17 +118,17 @@ class ReceivablePayableReport(object): row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2), cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount) + if self.filters.get(scrub(args.get("party_type"))): + row.append(gle.account_currency) + else: + row.append(company_currency) + # customer territory / supplier type if args.get("party_type") == "Customer": row += [self.get_territory(gle.party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(gle.party)] - if self.filters.get(scrub(args.get("party_type"))): - row.append(gle.account_currency) - else: - row.append(company_currency) - row.append(gle.remarks) data.append(row) diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 60eade4706..36e97343e6 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -18,18 +18,25 @@ class AccountsReceivableSummary(ReceivablePayableReport): columns += [ args.get("party_type") + " Name::140"] columns += [ - _("Total Invoiced Amt") + ":Currency:140", - _("Total Paid Amt") + ":Currency:140", - _("Total Outstanding Amt") + ":Currency:160", - "0-" + str(self.filters.range1) + ":Currency:100", - str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency:100", - str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency:100", - str(self.filters.range3) + _("-Above") + ":Currency:100"] + _("Total Invoiced Amt") + ":Currency/currency:140", + _("Total Paid Amt") + ":Currency/currency:140", + _("Total Outstanding Amt") + ":Currency/currency:160", + "0-" + str(self.filters.range1) + ":Currency/currency:100", + str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100", + str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100", + str(self.filters.range3) + _("-Above") + ":Currency/currency:100"] if args.get("party_type") == "Customer": columns += [_("Territory") + ":Link/Territory:80"] if args.get("party_type") == "Supplier": columns += [_("Supplier Type") + ":Link/Supplier Type:80"] + + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) return columns @@ -53,6 +60,8 @@ class AccountsReceivableSummary(ReceivablePayableReport): row += [self.get_territory(party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(party)] + + row.append(party_dict.currency) data.append(row) return data @@ -73,6 +82,8 @@ class AccountsReceivableSummary(ReceivablePayableReport): ) for k in party_total[d.party].keys(): party_total[d.party][k] += d.get(k, 0) + + party_total[d.party].currency = d.currency return party_total @@ -90,7 +101,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): cols += ["bill_no", "bill_date"] cols += ["invoiced_amt", "paid_amt", - "outstanding_amt", "age", "range1", "range2", "range3", "range4"] + "outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"] if args.get("party_type") == "Supplier": cols += ["supplier_type", "remarks"] diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 7be5649aa2..f1e706e5d6 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -16,6 +16,14 @@ def execute(filters=None): if item_list: item_tax, tax_accounts = get_tax_accounts(item_list, columns) + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + print company_currency data = [] for d in item_list: purchase_receipt = None @@ -34,7 +42,7 @@ def execute(filters=None): row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0)) total_tax = sum(row[last_col:]) - row += [total_tax, d.base_net_amount + total_tax] + row += [total_tax, d.base_net_amount + total_tax, company_currency] data.append(row) @@ -48,7 +56,8 @@ def get_columns(): "Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140", - _("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"] + _("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120" + ] def get_conditions(filters): conditions = "" @@ -110,7 +119,7 @@ def get_tax_accounts(item_list, columns): (tax_amount * d.base_net_amount) / d.base_net_total tax_accounts.sort() - columns += [account_head + ":Currency:80" for account_head in tax_accounts] - columns += ["Total Tax:Currency:80", "Total:Currency:80"] + columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts] + columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"] return item_tax, tax_accounts diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index e3c475303e..2401202937 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -14,7 +14,14 @@ def execute(filters=None): item_list = get_items(filters) if item_list: item_tax, tax_accounts = get_tax_accounts(item_list, columns) - + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + data = [] for d in item_list: delivery_note = None @@ -32,7 +39,7 @@ def execute(filters=None): row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0)) total_tax = sum(row[last_col:]) - row += [total_tax, d.base_net_amount + total_tax] + row += [total_tax, d.base_net_amount + total_tax, company_currency] data.append(row) @@ -48,7 +55,7 @@ def get_columns(): _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120", - _("Rate") + ":Currency:120", _("Amount") + ":Currency:120" + _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120" ] def get_conditions(filters): @@ -108,7 +115,7 @@ def get_tax_accounts(item_list, columns): flt((tax_amount * d.base_net_amount) / d.base_net_total) tax_accounts.sort() - columns += [account_head + ":Currency:80" for account_head in tax_accounts] - columns += ["Total Tax:Currency:80", "Total:Currency:80"] + columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts] + columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"] return item_tax, tax_accounts diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index c8698030e7..7934bf25cd 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -21,6 +21,8 @@ def execute(filters=None): invoice_expense_map, expense_accounts) invoice_po_pr_map = get_invoice_po_pr_map(invoice_list) supplier_details = get_supplier_deatils(invoice_list) + + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") data = [] for inv in invoice_list: @@ -32,7 +34,7 @@ def execute(filters=None): row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name, supplier_details.get(inv.supplier), inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks, - ", ".join(purchase_order), ", ".join(purchase_receipt)] + ", ".join(purchase_order), ", ".join(purchase_receipt), company_currency] # map expense values base_net_total = 0 @@ -62,10 +64,19 @@ def execute(filters=None): def get_columns(invoice_list): """return columns based on filters""" columns = [ - _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier Id") + "::120", - _("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120", - _("Project") + ":Link/Project:80", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", - _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100" + _("Invoice") + ":Link/Purchase Invoice:120", + _("Posting Date") + ":Date:80", _("Supplier Id") + "::120", + _("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", + _("Payable Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", + _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", + _("Purchase Order") + ":Link/Purchase Order:100", + _("Purchase Receipt") + ":Link/Purchase Receipt:100", + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + } ] expense_accounts = tax_accounts = expense_columns = tax_columns = [] @@ -84,14 +95,14 @@ def get_columns(invoice_list): ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) - expense_columns = [(account + ":Currency:120") for account in expense_accounts] + expense_columns = [(account + ":Currency/currency:120") for account in expense_accounts] for account in tax_accounts: if account not in expense_accounts: - tax_columns.append(account + ":Currency:120") + tax_columns.append(account + ":Currency/currency:120") - columns = columns + expense_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \ - [_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120", - _("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"] + columns = columns + expense_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \ + [_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120", + _("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"] return columns, expense_accounts, tax_accounts diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index f68adad7d9..d09cfc1924 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -22,6 +22,7 @@ def execute(filters=None): invoice_so_dn_map = get_invoice_so_dn_map(invoice_list) customer_map = get_customer_deatils(invoice_list) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") data = [] for inv in invoice_list: @@ -32,7 +33,8 @@ def execute(filters=None): row = [inv.name, inv.posting_date, inv.customer, inv.customer_name, customer_map.get(inv.customer, {}).get("customer_group"), customer_map.get(inv.customer, {}).get("territory"), - inv.debit_to, inv.project, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)] + inv.debit_to, inv.project, inv.remarks, + ", ".join(sales_order), ", ".join(delivery_note), company_currency] # map income values base_net_total = 0 @@ -66,7 +68,13 @@ def get_columns(invoice_list): _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120", _("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80", _("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150", - _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100" + _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + } ] income_accounts = tax_accounts = income_columns = tax_columns = [] @@ -83,14 +91,14 @@ def get_columns(invoice_list): and parent in (%s) order by account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) - income_columns = [(account + ":Currency:120") for account in income_accounts] + income_columns = [(account + ":Currency/currency:120") for account in income_accounts] for account in tax_accounts: if account not in income_accounts: - tax_columns.append(account + ":Currency:120") + tax_columns.append(account + ":Currency/currency:120") - columns = columns + income_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \ - [_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120", - _("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"] + columns = columns + income_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \ + [_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120", + _("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"] return columns, income_accounts, tax_accounts