From 4bb90add1df6e6b5aa9cc69e6589ef7e8e902ae0 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 15 Oct 2018 19:07:49 +0530 Subject: [PATCH] Currency symbol bug fix (#15698) --- .../sales_person_wise_transaction_summary.py | 110 ++++++++++++++++-- 1 file changed, 103 insertions(+), 7 deletions(-) diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py index ae2cf8c550..345d608fef 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import msgprint, _ from frappe.utils import flt +from erpnext import get_company_currency def execute(filters=None): if not filters: filters = {} @@ -14,12 +15,14 @@ def execute(filters=None): item_details = get_item_details() data = [] + company_currency = get_company_currency(filters["company"]) + for d in entries: if d.stock_qty > 0 or filters.get('show_return_entries', 0): data.append([ d.name, d.customer, d.territory, d.posting_date, d.item_code, item_details.get(d.item_code, {}).get("item_group"), item_details.get(d.item_code, {}).get("brand"), - d.stock_qty, d.base_net_amount, d.sales_person, d.allocated_percentage, d.contribution_amt + d.stock_qty, d.base_net_amount, d.sales_person, d.allocated_percentage, d.contribution_amt, company_currency ]) if data: @@ -32,12 +35,105 @@ def get_columns(filters): if not filters.get("doc_type"): msgprint(_("Please select the document type first"), raise_exception=1) - return [filters["doc_type"] + ":Link/" + filters["doc_type"] + ":140", - _("Customer") + ":Link/Customer:140", _("Territory") + ":Link/Territory:100", _("Posting Date") + ":Date:100", - _("Item Code") + ":Link/Item:120", _("Item Group") + ":Link/Item Group:120", - _("Brand") + ":Link/Brand:120", _("Qty") + ":Float:100", _("Amount") + ":Currency:120", - _("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + "::110", - _("Contribution Amount") + ":Currency:140"] + columns = [ + { + "label": _(filters["doc_type"]), + "options": filters["doc_type"], + "fieldname": frappe.scrub(filters['doc_type']), + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Customer"), + "options": "Customer", + "fieldname": "customer", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Territory"), + "options": "Territory", + "fieldname": "territory", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Warehouse"), + "options": "Warehouse", + "fieldname": "warehouse", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Posting Date"), + "fieldname": "posting_date", + "fieldtype": "Date", + "width": 140 + }, + { + "label": _("Item Code"), + "options": "Item", + "fieldname": "item_code", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Item Group"), + "options": "Item Group", + "fieldname": "item_group", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Brand"), + "options": "Brand", + "fieldname": "brand", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Qty"), + "fieldname": "qty", + "fieldtype": "Float", + "width": 140 + }, + { + "label": _("Amount"), + "options": "currency", + "fieldname": "amount", + "fieldtype": "Currency", + "width": 140 + }, + { + "label": _("Sales Person"), + "options": "Sales Person", + "fieldname": "sales_person", + "fieldtype": "Link", + "width": 140 + }, + { + "label": _("Contribution %"), + "fieldname": "contribution", + "fieldtype": "Float", + "width": 140 + }, + { + "label": _("Contribution Amount"), + "options": "currency", + "fieldname": "contribution_amt", + "fieldtype": "Currency", + "width": 140 + }, + { + "label":_("Currency"), + "options": "Currency", + "fieldname":"currency", + "fieldtype":"Link", + "hidden" : 1 + } + ] + + return columns def get_entries(filters): date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"