fix: should never get cutomer price on purchase document (#34002)

* fix: never get cutomer price on purchase document

chores: syntax

chore: typo in stock_entry get_uom_details (#33998)

fix: typo in stock_entry get_uom_details

chores: syntax

* feat: add test for get_item_detail price list oriented

* feat: add test for get_item_detail price price oriented

* feat: add test for get_item_detail price price oriented

* chore: clean test code
diff --git a/erpnext/stock/doctype/item_price/test_records.json b/erpnext/stock/doctype/item_price/test_records.json
index 0a3d7e8..afe5ad6 100644
--- a/erpnext/stock/doctype/item_price/test_records.json
+++ b/erpnext/stock/doctype/item_price/test_records.json
@@ -38,5 +38,19 @@
   "price_list_rate": 1000,
   "valid_from": "2017-04-10",
   "valid_upto": "2017-04-17"
+ },
+ {
+  "doctype": "Item Price",
+  "item_code": "_Test Item",
+  "price_list": "_Test Buying Price List",
+  "price_list_rate": 100,
+  "supplier": "_Test Supplier"
+ },
+ {
+  "doctype": "Item Price",
+  "item_code": "_Test Item",
+  "price_list": "_Test Selling Price List",
+  "price_list_rate": 200,
+  "customer": "_Test Customer"
  }
 ]
diff --git a/erpnext/stock/doctype/price_list/test_records.json b/erpnext/stock/doctype/price_list/test_records.json
index 7ca949c..e02a7ad 100644
--- a/erpnext/stock/doctype/price_list/test_records.json
+++ b/erpnext/stock/doctype/price_list/test_records.json
@@ -31,5 +31,21 @@
         "enabled": 1,
         "price_list_name": "_Test Price List Rest of the World",
         "selling": 1
+    },
+    {
+        "buying": 0,
+        "currency": "USD",
+        "doctype": "Price List",
+        "enabled": 1,
+        "price_list_name": "_Test Selling Price List",
+        "selling": 1
+    },
+    {
+        "buying": 1,
+        "currency": "USD",
+        "doctype": "Price List",
+        "enabled": 1,
+        "price_list_name": "_Test Buying Price List",
+        "selling": 0
     }
 ]
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 5af1441..b53f429 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -88,8 +88,15 @@
 
 	update_party_blanket_order(args, out)
 
+	# Never try to find a customer price if customer is set in these Doctype
+	current_customer = args.customer
+	if args.get("doctype") in ["Purchase Order", "Purchase Receipt", "Purchase Invoice"]:
+		args.customer = None
+
 	out.update(get_price_list_rate(args, item))
 
+	args.customer = current_customer
+
 	if args.customer and cint(args.is_pos):
 		out.update(get_pos_profile_item_details(args.company, args, update_data=True))
 
diff --git a/erpnext/stock/tests/test_get_item_details.py b/erpnext/stock/tests/test_get_item_details.py
new file mode 100644
index 0000000..b53e29e
--- /dev/null
+++ b/erpnext/stock/tests/test_get_item_details.py
@@ -0,0 +1,40 @@
+import json
+
+import frappe
+from frappe.test_runner import make_test_records
+from frappe.tests.utils import FrappeTestCase
+
+from erpnext.stock.get_item_details import get_item_details
+
+test_ignore = ["BOM"]
+test_dependencies = ["Customer", "Supplier", "Item", "Price List", "Item Price"]
+
+
+class TestGetItemDetail(FrappeTestCase):
+	def setUp(self):
+		make_test_records("Price List")
+		super().setUp()
+
+	def test_get_item_detail_purchase_order(self):
+
+		args = frappe._dict(
+			{
+				"item_code": "_Test Item",
+				"company": "_Test Company",
+				"customer": "_Test Customer",
+				"conversion_rate": 1.0,
+				"price_list_currency": "USD",
+				"plc_conversion_rate": 1.0,
+				"doctype": "Purchase Order",
+				"name": None,
+				"supplier": "_Test Supplier",
+				"transaction_date": None,
+				"conversion_rate": 1.0,
+				"price_list": "_Test Buying Price List",
+				"is_subcontracted": 0,
+				"ignore_pricing_rule": 1,
+				"qty": 1,
+			}
+		)
+		details = get_item_details(args)
+		self.assertEqual(details.get("price_list_rate"), 100)