fix: Test Cases and block expense on outward entry

- Throw error if rate present against Customer Provided Item in DN and SI
- Added test cases for Sales Invoice and Delivery Note
- Allow SI and DN with 0 rate in Test
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 55a2c43..4037f2f 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -383,6 +383,9 @@
 			# Customer Provided parts will have zero valuation rate
 			if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'):
 				d.allow_zero_valuation_rate = 1
+				if d.parenttype in ["Delivery Note", "Sales Invoice"] and d.rate:
+					frappe.throw(_("Row #{0}: {1} cannot have {2} as it is a Customer Provided Item")
+						.format(d.idx, frappe.bold(d.item_code), frappe.bold("Rate")))
 
 def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
 		warehouse_account=None, company=None):