feat: provision to create PR from SCR
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 8943066..6c9d339 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -122,6 +122,20 @@
 		erpnext.accounts.dimensions.update_dimension(frm, frm.doctype);
 	},
 
+	subcontracting_receipt: (frm) => {
+		if (frm.doc.is_subcontracted === 1 && frm.doc.is_old_subcontracting_flow === 0 && frm.doc.subcontracting_receipt) {
+			frm.set_value('items', null);
+
+			erpnext.utils.map_current_doc({
+				method: 'erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt.make_purchase_receipt',
+				source_name: frm.doc.subcontracting_receipt,
+				target_doc: frm,
+				freeze: true,
+				freeze_message: __('Mapping Purchase Receipt ...'),
+			});
+		}
+	},
+
 	toggle_display_account_head: function(frm) {
 		var enabled = erpnext.is_perpetual_inventory_enabled(frm.doc.company)
 		frm.fields_dict["items"].grid.set_column_disp(["cost_center"], enabled);
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
index 5585a4a..762cdc9 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
@@ -26,27 +26,36 @@
 	refresh: (frm) => {
 		if (frm.doc.docstatus === 1) {
 			frm.add_custom_button(__('Stock Ledger'), () => {
-					frappe.route_options = {
-						voucher_no: frm.doc.name,
-						from_date: frm.doc.posting_date,
-						to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
-						company: frm.doc.company,
-						show_cancelled_entries: frm.doc.docstatus === 2
-					}
-					frappe.set_route('query-report', 'Stock Ledger');
-				}, __('View'));
+				frappe.route_options = {
+					voucher_no: frm.doc.name,
+					from_date: frm.doc.posting_date,
+					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
+					company: frm.doc.company,
+					show_cancelled_entries: frm.doc.docstatus === 2
+				}
+				frappe.set_route('query-report', 'Stock Ledger');
+			}, __('View'));
 
 			frm.add_custom_button(__('Accounting Ledger'), () => {
-					frappe.route_options = {
-						voucher_no: frm.doc.name,
-						from_date: frm.doc.posting_date,
-						to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
-						company: frm.doc.company,
-						group_by: 'Group by Voucher (Consolidated)',
-						show_cancelled_entries: frm.doc.docstatus === 2
-					}
-					frappe.set_route('query-report', 'General Ledger');
-				}, __('View'));
+				frappe.route_options = {
+					voucher_no: frm.doc.name,
+					from_date: frm.doc.posting_date,
+					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
+					company: frm.doc.company,
+					group_by: 'Group by Voucher (Consolidated)',
+					show_cancelled_entries: frm.doc.docstatus === 2
+				}
+				frappe.set_route('query-report', 'General Ledger');
+			}, __('View'));
+
+			frm.add_custom_button(__('Purchase Receipt'), () => {
+				frappe.model.open_mapped_doc({
+					method: 'erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt.make_purchase_receipt',
+					frm: frm,
+					freeze: true,
+					freeze_message: __('Creating Purchase Receipt ...')
+				});
+			}, __('Create'));
 		}
 
 		if (!frm.doc.is_return && frm.doc.docstatus === 1 && frm.doc.per_returned < 100) {
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
index b980dbd..000078f 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
@@ -542,18 +542,20 @@
 	return make_return_doc("Subcontracting Receipt", source_name, target_doc)
 
 
-def make_purchase_receipt(subcontracting_receipt, save=False, submit=False, notify=False):
-	if isinstance(subcontracting_receipt, str):
-		subcontracting_receipt = frappe.get_doc("Subcontracting Receipt", subcontracting_receipt)
+@frappe.whitelist()
+def make_purchase_receipt(source_name, target_doc=None, save=False, submit=False, notify=False):
+	if isinstance(source_name, str):
+		source_name = frappe.get_doc("Subcontracting Receipt", source_name)
 
-	if not subcontracting_receipt.is_return:
-		purchase_receipt = frappe.new_doc("Purchase Receipt")
-		purchase_receipt.is_subcontracted = 1
-		purchase_receipt.is_old_subcontracting_flow = 0
+	if not source_name.is_return:
+		if not target_doc:
+			target_doc = frappe.new_doc("Purchase Receipt")
+			target_doc.is_subcontracted = 1
+			target_doc.is_old_subcontracting_flow = 0
 
-		purchase_receipt = get_mapped_doc(
+		target_doc = get_mapped_doc(
 			"Subcontracting Receipt",
-			subcontracting_receipt.name,
+			source_name.name,
 			{
 				"Subcontracting Receipt": {
 					"doctype": "Purchase Receipt",
@@ -566,12 +568,12 @@
 					"field_no_map": ["total_qty", "total"],
 				},
 			},
-			purchase_receipt,
+			target_doc,
 			ignore_child_tables=True,
 		)
 
 		po_items_details = {}
-		for item in subcontracting_receipt.items:
+		for item in source_name.items:
 			if item.purchase_order and item.purchase_order_item:
 				if item.purchase_order not in po_items_details:
 					po_doc = frappe.get_doc("Purchase Order", item.purchase_order)
@@ -592,31 +594,33 @@
 						"purchase_order_item": item.purchase_order_item,
 						"subcontracting_receipt_item": item.name,
 					}
-					purchase_receipt.append("items", item_row)
+					target_doc.append("items", item_row)
 
-		if not purchase_receipt.items:
+		if not target_doc.items:
 			frappe.throw(
 				_("Purchase Order Item reference is missing in Subcontracting Receipt {0}").format(
-					subcontracting_receipt.name
+					source_name.name
 				)
 			)
 
-		if (save or submit) and frappe.has_permission(purchase_receipt.doctype, "create"):
-			purchase_receipt.save()
+		target_doc.set_missing_values()
 
-			if submit and frappe.has_permission(purchase_receipt.doctype, "submit", purchase_receipt):
+		if (save or submit) and frappe.has_permission(target_doc.doctype, "create"):
+			target_doc.save()
+
+			if submit and frappe.has_permission(target_doc.doctype, "submit", target_doc):
 				try:
-					purchase_receipt.submit()
+					target_doc.submit()
 				except Exception as e:
-					purchase_receipt.add_comment("Comment", _("Submit Action Failed") + "<br><br>" + str(e))
+					target_doc.add_comment("Comment", _("Submit Action Failed") + "<br><br>" + str(e))
 
 			if notify:
 				frappe.msgprint(
 					_("Purchase Receipt {0} created.").format(
-						get_link_to_form(purchase_receipt.doctype, purchase_receipt.name)
+						get_link_to_form(target_doc.doctype, target_doc.name)
 					),
 					indicator="green",
 					alert=True,
 				)
 
-		return purchase_receipt
+		return target_doc
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
index f6e1356..4d15938 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
@@ -3,7 +3,7 @@
 
 def get_data():
 	return {
-		"fieldname": "subcontracting_receipt_no",
+		"fieldname": "subcontracting_receipt",
 		"non_standard_fieldnames": {
 			"Subcontracting Receipt": "return_against",
 		},