feat: Added custom button to make inter company order
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 28ceab5..489e286 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -138,6 +138,20 @@
 							erpnext.utils.make_subscription(doc.doctype, doc.name)
 						}, __('Create'))
 					}
+
+					if (doc.docstatus == 1 && !doc.inter_company_order_reference) {
+						let me = this;
+						frappe.model.with_doc("Supplier", me.frm.doc.supplier, () => {
+							let supplier = frappe.model.get_doc("Supplier", me.frm.doc.supplier);
+							let internal = supplier.is_internal_supplier;
+							let disabled = supplier.disabled;
+							if (internal == 1 && disabled == 0) {
+								me.frm.add_custom_button("Inter Company Order", function() {
+									me.make_inter_company_order(me.frm);
+								}, __('Create'));
+							}
+						});
+					}
 				}
 				if(flt(doc.per_billed)==0) {
 					this.frm.add_custom_button(__('Payment Request'),
@@ -296,6 +310,13 @@
 		});
 	},
 
+	make_inter_company_order: function(frm) {
+		frappe.model.open_mapped_doc({
+			method: "erpnext.buying.doctype.purchase_order.purchase_order.make_inter_company_sales_order",
+			frm: frm
+		});
+	},
+
 	make_purchase_receipt: function() {
 		frappe.model.open_mapped_doc({
 			method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index adb58a1..064748d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -204,6 +204,20 @@
 							erpnext.utils.make_subscription(doc.doctype, doc.name)
 						}, __('Create'))
 					}
+
+					if (doc.docstatus == 1 && !doc.inter_company_order_reference) {
+						let me = this;
+						frappe.model.with_doc("Customer", me.frm.doc.customer, () => {
+							let customer = frappe.model.get_doc("Customer", me.frm.doc.customer);
+							let internal = customer.is_internal_customer;
+							let disabled = customer.disabled;
+							if (internal == 1 && disabled == 0) {
+								me.frm.add_custom_button("Inter Company Order", function() {
+									me.make_inter_company_order();
+								}, __('Create'));
+							}
+						});
+					}
 				}
 				// payment request
 				if(flt(doc.per_billed)==0) {
@@ -500,6 +514,13 @@
 		})
 	},
 
+	make_inter_company_order: function() {
+		frappe.model.open_mapped_doc({
+			method: "erpnext.selling.doctype.sales_order.sales_order.make_inter_company_purchase_order",
+			frm: this.frm
+		});
+	},
+
 	make_maintenance_visit: function() {
 		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",