Merge pull request #47314 from frappe/mergify/bp/version-15-hotfix/pr-47234

fix: price currency in supplier quotation comparison (backport #47234)
This commit is contained in:
Mihir Kandoi
2025-04-29 12:40:31 +05:30
committed by GitHub

View File

@@ -83,19 +83,11 @@ def prepare_data(supplier_quotation_data, filters):
supplier_qty_price_map = {}
group_by_field = "supplier_name" if filters.get("group_by") == "Group by Supplier" else "item_code"
company_currency = frappe.db.get_default("currency")
float_precision = cint(frappe.db.get_default("float_precision")) or 2
for data in supplier_quotation_data:
group = data.get(group_by_field) # get item or supplier value for this row
supplier_currency = frappe.db.get_value("Supplier", data.get("supplier_name"), "default_currency")
if supplier_currency:
exchange_rate = get_exchange_rate(supplier_currency, company_currency)
else:
exchange_rate = 1
row = {
"item_code": ""
if group_by_field == "item_code"
@@ -103,7 +95,7 @@ def prepare_data(supplier_quotation_data, filters):
"supplier_name": "" if group_by_field == "supplier_name" else data.get("supplier_name"),
"quotation": data.get("parent"),
"qty": data.get("qty"),
"price": flt(data.get("amount") * exchange_rate, float_precision),
"price": flt(data.get("amount"), float_precision),
"uom": data.get("uom"),
"price_list_currency": data.get("price_list_currency"),
"currency": data.get("currency"),
@@ -209,6 +201,13 @@ def get_columns(filters):
columns = [
{"fieldname": "uom", "label": _("UOM"), "fieldtype": "Link", "options": "UOM", "width": 90},
{"fieldname": "qty", "label": _("Quantity"), "fieldtype": "Float", "width": 80},
{
"fieldname": "stock_uom",
"label": _("Stock UOM"),
"fieldtype": "Link",
"options": "UOM",
"width": 90,
},
{
"fieldname": "currency",
"label": _("Currency"),
@@ -223,13 +222,6 @@ def get_columns(filters):
"options": "currency",
"width": 110,
},
{
"fieldname": "stock_uom",
"label": _("Stock UOM"),
"fieldtype": "Link",
"options": "UOM",
"width": 90,
},
{
"fieldname": "price_per_unit",
"label": _("Price per Unit (Stock UOM)"),