mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-05 03:23:35 +00:00
fix: price currency in supplier quotation comparison
(cherry picked from commit 88926eb2a7)
This commit is contained in:
@@ -83,19 +83,11 @@ def prepare_data(supplier_quotation_data, filters):
|
|||||||
supplier_qty_price_map = {}
|
supplier_qty_price_map = {}
|
||||||
|
|
||||||
group_by_field = "supplier_name" if filters.get("group_by") == "Group by Supplier" else "item_code"
|
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
|
float_precision = cint(frappe.db.get_default("float_precision")) or 2
|
||||||
|
|
||||||
for data in supplier_quotation_data:
|
for data in supplier_quotation_data:
|
||||||
group = data.get(group_by_field) # get item or supplier value for this row
|
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 = {
|
row = {
|
||||||
"item_code": ""
|
"item_code": ""
|
||||||
if group_by_field == "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"),
|
"supplier_name": "" if group_by_field == "supplier_name" else data.get("supplier_name"),
|
||||||
"quotation": data.get("parent"),
|
"quotation": data.get("parent"),
|
||||||
"qty": data.get("qty"),
|
"qty": data.get("qty"),
|
||||||
"price": flt(data.get("amount") * exchange_rate, float_precision),
|
"price": flt(data.get("amount"), float_precision),
|
||||||
"uom": data.get("uom"),
|
"uom": data.get("uom"),
|
||||||
"price_list_currency": data.get("price_list_currency"),
|
"price_list_currency": data.get("price_list_currency"),
|
||||||
"currency": data.get("currency"),
|
"currency": data.get("currency"),
|
||||||
@@ -209,6 +201,13 @@ def get_columns(filters):
|
|||||||
columns = [
|
columns = [
|
||||||
{"fieldname": "uom", "label": _("UOM"), "fieldtype": "Link", "options": "UOM", "width": 90},
|
{"fieldname": "uom", "label": _("UOM"), "fieldtype": "Link", "options": "UOM", "width": 90},
|
||||||
{"fieldname": "qty", "label": _("Quantity"), "fieldtype": "Float", "width": 80},
|
{"fieldname": "qty", "label": _("Quantity"), "fieldtype": "Float", "width": 80},
|
||||||
|
{
|
||||||
|
"fieldname": "stock_uom",
|
||||||
|
"label": _("Stock UOM"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "UOM",
|
||||||
|
"width": 90,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
"label": _("Currency"),
|
"label": _("Currency"),
|
||||||
@@ -223,13 +222,6 @@ def get_columns(filters):
|
|||||||
"options": "currency",
|
"options": "currency",
|
||||||
"width": 110,
|
"width": 110,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "stock_uom",
|
|
||||||
"label": _("Stock UOM"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "UOM",
|
|
||||||
"width": 90,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "price_per_unit",
|
"fieldname": "price_per_unit",
|
||||||
"label": _("Price per Unit (Stock UOM)"),
|
"label": _("Price per Unit (Stock UOM)"),
|
||||||
|
|||||||
Reference in New Issue
Block a user