[feature] Blanket Order

- Creaete Sales or Purchase order from the blanket order
- If there is any blanket order for the customer/supplier rates will be fetched from that order
- Manually selecting the Blanket order will change the rates accordingly
- Upon submission of the order, the ordered qty will be updated in the Blanket Order
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index bbeb8e9..7eaba09 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -108,8 +108,11 @@
 		var item = frappe.get_doc(cdt, cdn);
 		frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 
-		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
-			precision("rate", item));
+		let item_rate = item.price_list_rate;
+		if (doc.doctype == "Purchase Order" && item.blanket_order_rate) {
+			item_rate = item.blanket_order_rate;
+		}
+		item.rate = flt(item_rate * (1 - item.discount_percentage / 100.0), precision("rate", item));
 
 		this.calculate_taxes_and_totals();
 	},