Currency symbol bug fix (#15690)

This commit is contained in:
deepeshgarg007 2018-10-15 18:22:28 +05:30 committed by Nabin Hait
parent 3185b37360
commit 7c443264a4

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe import msgprint, _ from frappe import msgprint, _
from frappe.utils import flt from frappe.utils import flt
from erpnext import get_company_currency
def execute(filters=None): def execute(filters=None):
if not filters: filters = {} if not filters: filters = {}
@ -14,12 +15,14 @@ def execute(filters=None):
item_details = get_item_details() item_details = get_item_details()
data = [] data = []
company_currency = get_company_currency(filters["company"])
for d in entries: for d in entries:
if d.stock_qty > 0 or filters.get('show_return_entries', 0): if d.stock_qty > 0 or filters.get('show_return_entries', 0):
data.append([ data.append([
d.name, d.customer, d.territory, item_details.get(d.item_code, {}).get("website_warehouse"), d.posting_date, d.item_code, d.name, d.customer, d.territory, item_details.get(d.item_code, {}).get("website_warehouse"), d.posting_date, d.item_code,
item_details.get(d.item_code, {}).get("item_group"), item_details.get(d.item_code, {}).get("brand"), 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: if data:
@ -32,13 +35,105 @@ def get_columns(filters):
if not filters.get("doc_type"): if not filters.get("doc_type"):
msgprint(_("Please select the document type first"), raise_exception=1) msgprint(_("Please select the document type first"), raise_exception=1)
return [filters["doc_type"] + ":Link/" + filters["doc_type"] + ":140", columns = [
_("Customer") + ":Link/Customer:140", _("Territory") + ":Link/Territory:100", _("Warehouse") + ":Link/Warehouse:100", {
_("Posting Date") + ":Date:100", "label": _(filters["doc_type"]),
_("Item Code") + ":Link/Item:120", _("Item Group") + ":Link/Item Group:120", "options": filters["doc_type"],
_("Brand") + ":Link/Brand:120", _("Qty") + ":Float:100", _("Amount") + ":Currency:120", "fieldname": frappe.scrub(filters['doc_type']),
_("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + "::110", "fieldtype": "Link",
_("Contribution Amount") + ":Currency:140"] "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): def get_entries(filters):
date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date" date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"