Test case fixed for multiple uom in selling
diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json
index a022225..732c446 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_records.json
+++ b/erpnext/accounts/doctype/sales_invoice/test_records.json
@@ -21,6 +21,8 @@
"parentfield": "items",
"qty": 1.0,
"rate": 500.0,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],
@@ -91,6 +93,8 @@
"parentfield": "items",
"price_list_rate": 500.0,
"qty": 1.0,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],
@@ -143,6 +147,8 @@
"price_list_rate": 50,
"qty": 10,
"rate": 50,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM"
},
{
@@ -155,6 +161,8 @@
"parentfield": "items",
"price_list_rate": 150,
"qty": 5,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"rate": 150,
"stock_uom": "_Test UOM"
}
@@ -265,6 +273,8 @@
"parentfield": "items",
"price_list_rate": 62.5,
"qty": 10,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM"
},
@@ -278,6 +288,8 @@
"parentfield": "items",
"price_list_rate": 190.66,
"qty": 5,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],
diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json
index b41fcc9..8a37dbb 100644
--- a/erpnext/selling/doctype/quotation/test_records.json
+++ b/erpnext/selling/doctype/quotation/test_records.json
@@ -23,6 +23,7 @@
"parentfield": "items",
"qty": 10.0,
"rate": 100.0,
+ "uom": "_Test UOM",
"stock_uom": "_Test UOM",
"conversion_factor": 1.0
}
diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json
index 7b13fb7..12e953a 100644
--- a/erpnext/selling/doctype/sales_order/test_records.json
+++ b/erpnext/selling/doctype/sales_order/test_records.json
@@ -28,7 +28,8 @@
"rate": 100.0,
"warehouse": "_Test Warehouse - _TC",
"stock_uom": "_Test UOM",
- "conversion_factor": 1.0
+ "conversion_factor": 1.0,
+ "uom": "_Test UOM"
}
],
"selling_price_list": "_Test Price List",
diff --git a/erpnext/stock/doctype/delivery_note/test_records.json b/erpnext/stock/doctype/delivery_note/test_records.json
index 9c11286..c76bab2 100644
--- a/erpnext/stock/doctype/delivery_note/test_records.json
+++ b/erpnext/stock/doctype/delivery_note/test_records.json
@@ -18,6 +18,8 @@
"parentfield": "items",
"qty": 1.0,
"rate": 100.0,
+ "uom": "_Test UOM",
+ "conversion_factor": 1,
"stock_uom": "_Test UOM",
"warehouse": "_Test Warehouse - _TC"
}
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 7854ac4..be20a81 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -510,7 +510,7 @@
["valuation_rate"], as_dict=True) or {"valuation_rate": 0}
elif not item.is_stock_item:
- valuation_rate =frappe.db.sql("""select sum(base_net_amount) / sum(stock_qty)
+ valuation_rate =frappe.db.sql("""select sum(base_net_amount) / sum(qty*conversion_factor)
from `tabPurchase Invoice Item`
where item_code = %s and docstatus=1""", item_code)