Merge pull request #33014 from deepeshgarg007/multi_invoice_payment

fix: Bulk payment generation against invoices
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 62cf0dc..c276be2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -2165,6 +2165,8 @@
 		if source.doctype == "Purchase Order Item" and target.doctype == "Sales Order Item":
 			target.purchase_order = source.parent
 			target.purchase_order_item = source.name
+			target.material_request = source.material_request
+			target.material_request_item = source.material_request_item
 
 		if (
 			source.get("purchase_order")
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index 5c1311d..19c913a 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -230,9 +230,17 @@
 		self.assertTrue(asset.journal_entry_for_scrap)
 
 		expected_gle = (
-			("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0),
+			(
+				"_Test Accumulated Depreciations - _TC",
+				flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")),
+				0.0,
+			),
 			("_Test Fixed Asset - _TC", 0.0, 100000.0),
-			("_Test Gain/Loss on Asset Disposal - _TC", 82000.0 - pro_rata_amount, 0.0),
+			(
+				"_Test Gain/Loss on Asset Disposal - _TC",
+				flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")),
+				0.0,
+			),
 		)
 
 		gle = frappe.db.sql(
@@ -288,9 +296,17 @@
 		pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount"))
 
 		expected_gle = (
-			("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0),
+			(
+				"_Test Accumulated Depreciations - _TC",
+				flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")),
+				0.0,
+			),
 			("_Test Fixed Asset - _TC", 0.0, 100000.0),
-			("_Test Gain/Loss on Asset Disposal - _TC", 57000.0 - pro_rata_amount, 0.0),
+			(
+				"_Test Gain/Loss on Asset Disposal - _TC",
+				flt(57000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")),
+				0.0,
+			),
 			("Debtors - _TC", 25000.0, 0.0),
 		)
 
diff --git a/erpnext/assets/doctype/location/location.py b/erpnext/assets/doctype/location/location.py
index 0d87bb2..5bff3dd 100644
--- a/erpnext/assets/doctype/location/location.py
+++ b/erpnext/assets/doctype/location/location.py
@@ -200,11 +200,11 @@
 			name as value,
 			is_group as expandable
 		from
-			`tab{doctype}` comp
+			`tabLocation` comp
 		where
 			ifnull(parent_location, "")={parent}
 		""".format(
-			doctype=doctype, parent=frappe.db.escape(parent)
+			parent=frappe.db.escape(parent)
 		),
 		as_dict=1,
 	)
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 2193985..ded45b8 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -1108,7 +1108,8 @@
    "fetch_from": "supplier.is_internal_supplier",
    "fieldname": "is_internal_supplier",
    "fieldtype": "Check",
-   "label": "Is Internal Supplier"
+   "label": "Is Internal Supplier",
+   "read_only": 1
   },
   {
    "fetch_from": "supplier.represents_company",
@@ -1232,7 +1233,7 @@
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-10-11 13:01:41.674352",
+ "modified": "2022-11-17 12:34:36.033363",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Purchase Order",
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 5a96131..5206a42 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -833,6 +833,10 @@
 		prepare_data_for_internal_transfer()
 		supplier = "_Test Internal Supplier 2"
 
+		mr = make_material_request(
+			qty=2, company="_Test Company with perpetual inventory", warehouse="Stores - TCP1"
+		)
+
 		po = create_purchase_order(
 			company="_Test Company with perpetual inventory",
 			supplier=supplier,
@@ -840,6 +844,8 @@
 			from_warehouse="_Test Internal Warehouse New 1 - TCP1",
 			qty=2,
 			rate=1,
+			material_request=mr.name,
+			material_request_item=mr.items[0].name,
 		)
 
 		so = make_inter_company_sales_order(po.name)
@@ -875,9 +881,11 @@
 		self.assertTrue(pi.items[0].purchase_order)
 		self.assertTrue(pi.items[0].po_detail)
 		pi.submit()
+		mr.reload()
 
 		po.load_from_db()
 		self.assertEqual(po.status, "Completed")
+		self.assertEqual(mr.status, "Received")
 
 
 def prepare_data_for_internal_transfer():
@@ -979,6 +987,8 @@
 				"schedule_date": add_days(nowdate(), 1),
 				"include_exploded_items": args.get("include_exploded_items", 1),
 				"against_blanket_order": args.against_blanket_order,
+				"material_request": args.material_request,
+				"material_request_item": args.material_request_item,
 			},
 		)
 
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index a560bda..bdbc9ce 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -478,7 +478,7 @@
 		conditions += "and rfq.transaction_date = '{0}'".format(filters.get("transaction_date"))
 
 	rfq_data = frappe.db.sql(
-		"""
+		f"""
 		select
 			distinct rfq.name, rfq.transaction_date,
 			rfq.company
@@ -486,15 +486,18 @@
 			`tabRequest for Quotation` rfq, `tabRequest for Quotation Supplier` rfq_supplier
 		where
 			rfq.name = rfq_supplier.parent
-			and rfq_supplier.supplier = '{0}'
+			and rfq_supplier.supplier = %(supplier)s
 			and rfq.docstatus = 1
-			and rfq.company = '{1}'
-			{2}
+			and rfq.company = %(company)s
+			{conditions}
 		order by rfq.transaction_date ASC
-		limit %(page_len)s offset %(start)s """.format(
-			filters.get("supplier"), filters.get("company"), conditions
-		),
-		{"page_len": page_len, "start": start},
+		limit %(page_len)s offset %(start)s """,
+		{
+			"page_len": page_len,
+			"start": start,
+			"company": filters.get("company"),
+			"supplier": filters.get("supplier"),
+		},
 		as_dict=1,
 	)
 
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index 39ef68a..15c82af 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -404,12 +404,17 @@
 			returned_qty_map = get_returned_qty_map_for_row(
 				source_parent.name, source_parent.supplier, source_doc.name, doctype
 			)
-			target_doc.received_qty = -1 * flt(
-				source_doc.received_qty - (returned_qty_map.get("received_qty") or 0)
-			)
-			target_doc.rejected_qty = -1 * flt(
-				source_doc.rejected_qty - (returned_qty_map.get("rejected_qty") or 0)
-			)
+
+			if doctype == "Subcontracting Receipt":
+				target_doc.received_qty = -1 * flt(source_doc.qty)
+			else:
+				target_doc.received_qty = -1 * flt(
+					source_doc.received_qty - (returned_qty_map.get("received_qty") or 0)
+				)
+				target_doc.rejected_qty = -1 * flt(
+					source_doc.rejected_qty - (returned_qty_map.get("rejected_qty") or 0)
+				)
+
 			target_doc.qty = -1 * flt(source_doc.qty - (returned_qty_map.get("qty") or 0))
 
 			if hasattr(target_doc, "stock_qty"):
diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py
index b8893aa..2d9093b 100644
--- a/erpnext/erpnext_integrations/taxjar_integration.py
+++ b/erpnext/erpnext_integrations/taxjar_integration.py
@@ -302,7 +302,7 @@
 			item.tax_collectable = flt(0)
 			item.taxable_amount = flt(0)
 
-		for tax in doc.taxes:
+		for tax in list(doc.taxes):
 			if tax.account_head == TAX_ACCOUNT_HEAD:
 				doc.taxes.remove(tax)
 		return
diff --git a/erpnext/patches/v13_0/update_exchange_rate_settings.py b/erpnext/patches/v13_0/update_exchange_rate_settings.py
index ed11c62..746195f 100644
--- a/erpnext/patches/v13_0/update_exchange_rate_settings.py
+++ b/erpnext/patches/v13_0/update_exchange_rate_settings.py
@@ -1,10 +1,5 @@
-import frappe
-
 from erpnext.setup.install import setup_currency_exchange
 
 
 def execute():
-	frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_result")
-	frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_details")
-	frappe.reload_doc("accounts", "doctype", "currency_exchange_settings")
 	setup_currency_exchange()
diff --git a/erpnext/public/scss/point-of-sale.scss b/erpnext/public/scss/point-of-sale.scss
index 7a3854c..7b7530b 100644
--- a/erpnext/public/scss/point-of-sale.scss
+++ b/erpnext/public/scss/point-of-sale.scss
@@ -159,6 +159,12 @@
 					}
 				}
 
+				.item-img {
+					@extend .image;
+					border-radius: 8px 8px 0 0;
+					object-fit: cover;
+				}
+
 				> .item-detail {
 					display: flex;
 					flex-direction: column;
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
index 72f9e6d..e860408 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
@@ -79,7 +79,7 @@
 		]
 	else:
 		return frappe.get_all(
-			doctype,
+			"Quality Procedure",
 			fields=["name as value", "is_group as expandable"],
 			filters=dict(parent_quality_procedure=parent),
 			order_by="name asc",
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 8c7c552..b801de3 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -95,8 +95,10 @@
   "item_tax_rate",
   "transaction_date",
   "inter_transfer_reference_section",
+  "material_request",
   "purchase_order",
   "column_break_89",
+  "material_request_item",
   "purchase_order_item"
  ],
  "fields": [
@@ -847,12 +849,23 @@
    "label": "quotation_item",
    "no_copy": 1,
    "read_only": 1
+  },
+  {
+   "fieldname": "material_request",
+   "fieldtype": "Link",
+   "label": "Material Request",
+   "options": "Material Request"
+  },
+  {
+   "fieldname": "material_request_item",
+   "fieldtype": "Data",
+   "label": "Material Request Item"
   }
  ],
  "idx": 1,
  "istable": 1,
  "links": [],
- "modified": "2022-11-10 18:20:30.137455",
+ "modified": "2022-11-18 11:39:01.741665",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Sales Order Item",
diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js
index 7a90fb0..b5eb048 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_selector.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js
@@ -103,9 +103,9 @@
 						<div class="flex items-center justify-center h-32 border-b-grey text-6xl text-grey-100">
 							<img
 								onerror="cur_pos.item_selector.handle_broken_image(this)"
-								class="h-full" src="${item_image}"
+								class="h-full item-img" src="${item_image}"
 								alt="${frappe.get_abbr(item.item_name)}"
-								style="object-fit: cover;">
+							>
 						</div>`;
 			} else {
 				return `<div class="item-qty-pill">
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 875f63d..d6f2378 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -689,11 +689,11 @@
 			name as value,
 			is_group as expandable
 		from
-			`tab{doctype}` comp
+			`tabCompany` comp
 		where
 			ifnull(parent_company, "")={parent}
 		""".format(
-			doctype=doctype, parent=frappe.db.escape(parent)
+			parent=frappe.db.escape(parent)
 		),
 		as_dict=1,
 	)
diff --git a/erpnext/setup/doctype/department/department.py b/erpnext/setup/doctype/department/department.py
index c4766ee..1745178 100644
--- a/erpnext/setup/doctype/department/department.py
+++ b/erpnext/setup/doctype/department/department.py
@@ -63,7 +63,7 @@
 	else:
 		filters["parent_department"] = parent
 
-	return frappe.get_all(doctype, fields=fields, filters=filters, order_by="name")
+	return frappe.get_all("Department", fields=fields, filters=filters, order_by="name")
 
 
 @frappe.whitelist()
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 9dd28dc..a1df764 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -902,6 +902,8 @@
 					"serial_no": "serial_no",
 					"purchase_order": "purchase_order",
 					"purchase_order_item": "purchase_order_item",
+					"material_request": "material_request",
+					"Material_request_item": "material_request_item",
 				},
 				"field_no_map": ["warehouse"],
 			},
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
index fd44e9c..b6b5ff4 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
@@ -11,11 +11,14 @@
 		},
 		"internal_links": {
 			"Sales Order": ["items", "against_sales_order"],
+			"Material Request": ["items", "material_request"],
+			"Purchase Order": ["items", "purchase_order"],
 		},
 		"transactions": [
 			{"label": _("Related"), "items": ["Sales Invoice", "Packing Slip", "Delivery Trip"]},
 			{"label": _("Reference"), "items": ["Sales Order", "Shipment", "Quality Inspection"]},
 			{"label": _("Returns"), "items": ["Stock Entry"]},
 			{"label": _("Subscription"), "items": ["Auto Repeat"]},
+			{"label": _("Internal Transfer"), "items": ["Material Request", "Purchase Order"]},
 		],
 	}
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 3229463..916ab2a 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -88,9 +88,11 @@
   "allow_zero_valuation_rate",
   "column_break_71",
   "internal_transfer_section",
+  "material_request",
   "purchase_order",
   "column_break_82",
   "purchase_order_item",
+  "material_request_item",
   "accounting_dimensions_section",
   "cost_center",
   "dimension_col_break",
@@ -818,13 +820,24 @@
    "fieldtype": "Check",
    "label": "Has Item Scanned",
    "read_only": 1
+  },
+  {
+   "fieldname": "material_request",
+   "fieldtype": "Link",
+   "label": "Material Request",
+   "options": "Material Request"
+  },
+  {
+   "fieldname": "material_request_item",
+   "fieldtype": "Data",
+   "label": "Material Request Item"
   }
  ],
  "idx": 1,
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2022-11-02 12:54:07.225623",
+ "modified": "2022-11-09 12:17:50.850142",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 817248e..04aee42 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -10,7 +10,7 @@
 import frappe
 from frappe import _, msgprint
 from frappe.model.mapper import get_mapped_doc
-from frappe.utils import cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate
+from frappe.utils import cint, cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate
 
 from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items
 from erpnext.controllers.buying_controller import BuyingController
@@ -500,13 +500,13 @@
 			and mr.per_ordered < 99.99
 			and mr.docstatus = 1
 			and mr.status != 'Stopped'
-			and mr.company = '{1}'
-			{2}
+			and mr.company = %s
+			{1}
 		order by mr_item.item_code ASC
-		limit {3} offset {4} """.format(
-			", ".join(["%s"] * len(supplier_items)), filters.get("company"), conditions, page_len, start
+		limit {2} offset {3} """.format(
+			", ".join(["%s"] * len(supplier_items)), conditions, cint(page_len), cint(start)
 		),
-		tuple(supplier_items),
+		tuple(supplier_items) + (filters.get("company"),),
 		as_dict=1,
 	)
 
diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
index 691a8b3..2bba52a 100644
--- a/erpnext/stock/doctype/material_request/material_request_dashboard.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -14,5 +14,6 @@
 			},
 			{"label": _("Stock"), "items": ["Stock Entry", "Purchase Receipt", "Pick List"]},
 			{"label": _("Manufacturing"), "items": ["Work Order"]},
+			{"label": _("Internal Transfer"), "items": ["Sales Order"]},
 		],
 	}
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 8ffd3f2..9321c2c 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -6,7 +6,7 @@
 from frappe import _
 from frappe.model.document import Document
 from frappe.model.mapper import get_mapped_doc
-from frappe.utils import cint, flt
+from frappe.utils import cint, cstr, flt
 
 from erpnext.stock.doctype.quality_inspection_template.quality_inspection_template import (
 	get_template_details,
@@ -219,68 +219,71 @@
 @frappe.whitelist()
 @frappe.validate_and_sanitize_search_inputs
 def item_query(doctype, txt, searchfield, start, page_len, filters):
-	if filters.get("from"):
-		from frappe.desk.reportview import get_match_cond
+	from frappe.desk.reportview import get_match_cond
 
-		mcond = get_match_cond(filters["from"])
-		cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')"
+	from_doctype = cstr(filters.get("doctype"))
+	if not from_doctype or not frappe.db.exists("DocType", from_doctype):
+		return []
 
-		if filters.get("parent"):
-			if (
-				filters.get("from") in ["Purchase Invoice Item", "Purchase Receipt Item"]
-				and filters.get("inspection_type") != "In Process"
-			):
-				cond = """and item_code in (select name from `tabItem` where
-					inspection_required_before_purchase = 1)"""
-			elif (
-				filters.get("from") in ["Sales Invoice Item", "Delivery Note Item"]
-				and filters.get("inspection_type") != "In Process"
-			):
-				cond = """and item_code in (select name from `tabItem` where
-					inspection_required_before_delivery = 1)"""
-			elif filters.get("from") == "Stock Entry Detail":
-				cond = """and s_warehouse is null"""
+	mcond = get_match_cond(from_doctype)
+	cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')"
 
-			if filters.get("from") in ["Supplier Quotation Item"]:
-				qi_condition = ""
+	if filters.get("parent"):
+		if (
+			from_doctype in ["Purchase Invoice Item", "Purchase Receipt Item"]
+			and filters.get("inspection_type") != "In Process"
+		):
+			cond = """and item_code in (select name from `tabItem` where
+				inspection_required_before_purchase = 1)"""
+		elif (
+			from_doctype in ["Sales Invoice Item", "Delivery Note Item"]
+			and filters.get("inspection_type") != "In Process"
+		):
+			cond = """and item_code in (select name from `tabItem` where
+				inspection_required_before_delivery = 1)"""
+		elif from_doctype == "Stock Entry Detail":
+			cond = """and s_warehouse is null"""
 
-			return frappe.db.sql(
-				"""
-					SELECT item_code
-					FROM `tab{doc}`
-					WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s
-					{qi_condition} {cond} {mcond}
-					ORDER BY item_code limit {page_len} offset {start}
-				""".format(
-					doc=filters.get("from"),
-					cond=cond,
-					mcond=mcond,
-					start=start,
-					page_len=page_len,
-					qi_condition=qi_condition,
-				),
-				{"parent": filters.get("parent"), "txt": "%%%s%%" % txt},
-			)
+		if from_doctype in ["Supplier Quotation Item"]:
+			qi_condition = ""
 
-		elif filters.get("reference_name"):
-			return frappe.db.sql(
-				"""
-					SELECT production_item
-					FROM `tab{doc}`
-					WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s
-					{qi_condition} {cond} {mcond}
-					ORDER BY production_item
-					limit {page_len} offset {start}
-				""".format(
-					doc=filters.get("from"),
-					cond=cond,
-					mcond=mcond,
-					start=start,
-					page_len=page_len,
-					qi_condition=qi_condition,
-				),
-				{"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt},
-			)
+		return frappe.db.sql(
+			"""
+				SELECT item_code
+				FROM `tab{doc}`
+				WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s
+				{qi_condition} {cond} {mcond}
+				ORDER BY item_code limit {page_len} offset {start}
+			""".format(
+				doc=from_doctype,
+				cond=cond,
+				mcond=mcond,
+				start=cint(start),
+				page_len=cint(page_len),
+				qi_condition=qi_condition,
+			),
+			{"parent": filters.get("parent"), "txt": "%%%s%%" % txt},
+		)
+
+	elif filters.get("reference_name"):
+		return frappe.db.sql(
+			"""
+				SELECT production_item
+				FROM `tab{doc}`
+				WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s
+				{qi_condition} {cond} {mcond}
+				ORDER BY production_item
+				limit {page_len} offset {start}
+			""".format(
+				doc=from_doctype,
+				cond=cond,
+				mcond=mcond,
+				start=cint(start),
+				page_len=cint(page_len),
+				qi_condition=qi_condition,
+			),
+			{"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt},
+		)
 
 
 @frappe.whitelist()
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index af7f20f..b725d49 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -394,7 +394,7 @@
 	)
 
 	# check if any SLEs are actually Opening Stock Reconciliation
-	for sle in sl_entries:
+	for sle in list(sl_entries):
 		if (
 			sle.get("voucher_type") == "Stock Reconciliation"
 			and sle.posting_date == filters.from_date
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
index 5cd4e63..3385eac 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
@@ -1,700 +1,701 @@
 {
-    "actions": [],
-    "autoname": "naming_series:",
-    "creation": "2022-04-18 11:20:44.226738",
-    "doctype": "DocType",
-    "document_type": "Document",
-    "editable_grid": 1,
-    "engine": "InnoDB",
-    "field_order": [
-        "title",
-        "naming_series",
-        "supplier",
-        "supplier_name",
-        "column_break1",
-        "company",
-        "posting_date",
-        "posting_time",
-        "set_posting_time",
-        "is_return",
-        "return_against",
-        "accounting_dimensions_section",
-        "cost_center",
-        "dimension_col_break",
-        "project",
-        "section_addresses",
-        "supplier_address",
-        "contact_person",
-        "address_display",
-        "contact_display",
-        "contact_mobile",
-        "contact_email",
-        "col_break_address",
-        "shipping_address",
-        "shipping_address_display",
-        "billing_address",
-        "billing_address_display",
-        "sec_warehouse",
-        "set_warehouse",
-        "rejected_warehouse",
-        "col_break_warehouse",
-        "supplier_warehouse",
-        "items_section",
-        "items",
-        "section_break0",
-        "total_qty",
-        "column_break_27",
-        "total",
-        "raw_material_details",
-        "get_current_stock",
-        "supplied_items",
-        "additional_costs_section",
-        "distribute_additional_costs_based_on",
-        "additional_costs",
-        "total_additional_costs",
-        "section_break_46",
-        "in_words",
-        "bill_no",
-        "bill_date",
-        "more_info",
-        "status",
-        "column_break_39",
-        "per_returned",
-        "section_break_47",
-        "amended_from",
-        "range",
-        "column_break4",
-        "represents_company",
-        "subscription_detail",
-        "auto_repeat",
-        "printing_settings",
-        "letter_head",
-        "language",
-        "instructions",
-        "column_break_97",
-        "select_print_heading",
-        "other_details",
-        "remarks",
-        "transporter_info",
-        "transporter_name",
-        "column_break5",
-        "lr_no",
-        "lr_date"
-    ],
-    "fields": [
-        {
-            "allow_on_submit": 1,
-            "default": "{supplier_name}",
-            "fieldname": "title",
-            "fieldtype": "Data",
-            "hidden": 1,
-            "label": "Title",
-            "no_copy": 1,
-            "print_hide": 1
-        },
-        {
-            "fieldname": "naming_series",
-            "fieldtype": "Select",
-            "label": "Series",
-            "no_copy": 1,
-            "options": "MAT-SCR-.YYYY.-\nMAT-SCR-RET-.YYYY.-",
-            "print_hide": 1,
-            "reqd": 1,
-            "set_only_once": 1
-        },
-        {
-            "bold": 1,
-            "fieldname": "supplier",
-            "fieldtype": "Link",
-            "in_global_search": 1,
-            "label": "Supplier",
-            "options": "Supplier",
-            "print_hide": 1,
-            "print_width": "150px",
-            "reqd": 1,
-            "search_index": 1,
-            "width": "150px"
-        },
-        {
-            "bold": 1,
-            "depends_on": "supplier",
-            "fetch_from": "supplier.supplier_name",
-            "fieldname": "supplier_name",
-            "fieldtype": "Data",
-            "in_global_search": 1,
-            "label": "Supplier Name",
-            "read_only": 1
-        },
-        {
-            "fieldname": "column_break1",
-            "fieldtype": "Column Break",
-            "print_width": "50%",
-            "width": "50%"
-        },
-        {
-            "default": "Today",
-            "fieldname": "posting_date",
-            "fieldtype": "Date",
-            "in_list_view": 1,
-            "label": "Date",
-            "no_copy": 1,
-            "print_width": "100px",
-            "read_only_depends_on": "eval: !doc.set_posting_time",
-            "reqd": 1,
-            "search_index": 1,
-            "width": "100px"
-        },
-        {
-            "description": "Time at which materials were received",
-            "fieldname": "posting_time",
-            "fieldtype": "Time",
-            "label": "Posting Time",
-            "no_copy": 1,
-            "print_hide": 1,
-            "print_width": "100px",
-            "read_only_depends_on": "eval: !doc.set_posting_time",
-            "reqd": 1,
-            "width": "100px"
-        },
-        {
-            "fieldname": "company",
-            "fieldtype": "Link",
-            "in_standard_filter": 1,
-            "label": "Company",
-            "options": "Company",
-            "print_hide": 1,
-            "print_width": "150px",
-            "remember_last_selected_value": 1,
-            "reqd": 1,
-            "width": "150px"
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "section_addresses",
-            "fieldtype": "Section Break",
-            "label": "Address and Contact"
-        },
-        {
-            "fieldname": "supplier_address",
-            "fieldtype": "Link",
-            "label": "Select Supplier Address",
-            "options": "Address",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "contact_person",
-            "fieldtype": "Link",
-            "label": "Contact Person",
-            "options": "Contact",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "address_display",
-            "fieldtype": "Small Text",
-            "label": "Address",
-            "read_only": 1
-        },
-        {
-            "fieldname": "contact_display",
-            "fieldtype": "Small Text",
-            "in_global_search": 1,
-            "label": "Contact",
-            "read_only": 1
-        },
-        {
-            "fieldname": "contact_mobile",
-            "fieldtype": "Small Text",
-            "label": "Mobile No",
-            "read_only": 1
-        },
-        {
-            "fieldname": "contact_email",
-            "fieldtype": "Small Text",
-            "label": "Contact Email",
-            "options": "Email",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "col_break_address",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "shipping_address",
-            "fieldtype": "Link",
-            "label": "Select Shipping Address",
-            "options": "Address",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "shipping_address_display",
-            "fieldtype": "Small Text",
-            "label": "Shipping Address",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "sec_warehouse",
-            "fieldtype": "Section Break"
-        },
-        {
-            "description": "Sets 'Accepted Warehouse' in each row of the Items table.",
-            "fieldname": "set_warehouse",
-            "fieldtype": "Link",
-            "label": "Accepted Warehouse",
-            "options": "Warehouse",
-            "print_hide": 1
-        },
-        {
-            "description": "Sets 'Rejected Warehouse' in each row of the Items table.",
-            "fieldname": "rejected_warehouse",
-            "fieldtype": "Link",
-            "label": "Rejected Warehouse",
-            "no_copy": 1,
-            "options": "Warehouse",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "col_break_warehouse",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "supplier_warehouse",
-            "fieldtype": "Link",
-            "label": "Supplier Warehouse",
-            "no_copy": 1,
-            "options": "Warehouse",
-            "print_hide": 1,
-            "print_width": "50px",
-            "width": "50px"
-        },
-        {
-            "fieldname": "items_section",
-            "fieldtype": "Section Break",
-            "options": "fa fa-shopping-cart"
-        },
-        {
-            "allow_bulk_edit": 1,
-            "fieldname": "items",
-            "fieldtype": "Table",
-            "label": "Items",
-            "options": "Subcontracting Receipt Item",
-            "reqd": 1
-        },
-        {
-            "depends_on": "supplied_items",
-            "fieldname": "get_current_stock",
-            "fieldtype": "Button",
-            "label": "Get Current Stock",
-            "options": "get_current_stock",
-            "print_hide": 1
-        },
-        {
-            "collapsible": 1,
-            "collapsible_depends_on": "supplied_items",
-            "depends_on": "supplied_items",
-            "fieldname": "raw_material_details",
-            "fieldtype": "Section Break",
-            "label": "Raw Materials Consumed",
-            "options": "fa fa-table",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "supplied_items",
-            "fieldtype": "Table",
-            "label": "Consumed Items",
-            "no_copy": 1,
-            "options": "Subcontracting Receipt Supplied Item",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "section_break0",
-            "fieldtype": "Section Break"
-        },
-        {
-            "fieldname": "total_qty",
-            "fieldtype": "Float",
-            "label": "Total Quantity",
-            "read_only": 1
-        },
-        {
-            "fieldname": "column_break_27",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "total",
-            "fieldtype": "Currency",
-            "label": "Total",
-            "options": "currency",
-            "read_only": 1
-        },
-        {
-            "fieldname": "section_break_46",
-            "fieldtype": "Section Break"
-        },
-        {
-            "fieldname": "in_words",
-            "fieldtype": "Data",
-            "label": "In Words",
-            "length": 240,
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "bill_no",
-            "fieldtype": "Data",
-            "hidden": 1,
-            "label": "Bill No",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "bill_date",
-            "fieldtype": "Date",
-            "hidden": 1,
-            "label": "Bill Date",
-            "print_hide": 1
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "more_info",
-            "fieldtype": "Section Break",
-            "label": "More Information",
-            "options": "fa fa-file-text"
-        },
-        {
-            "default": "Draft",
-            "fieldname": "status",
-            "fieldtype": "Select",
-            "in_standard_filter": 1,
-            "label": "Status",
-            "no_copy": 1,
-            "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
-            "print_hide": 1,
-            "print_width": "150px",
-            "read_only": 1,
-            "reqd": 1,
-            "search_index": 1,
-            "width": "150px"
-        },
-        {
-            "fieldname": "amended_from",
-            "fieldtype": "Link",
-            "hidden": 1,
-            "ignore_user_permissions": 1,
-            "label": "Amended From",
-            "no_copy": 1,
-            "options": "Subcontracting Receipt",
-            "print_hide": 1,
-            "print_width": "150px",
-            "read_only": 1,
-            "width": "150px"
-        },
-        {
-            "fieldname": "range",
-            "fieldtype": "Data",
-            "hidden": 1,
-            "label": "Range",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "column_break4",
-            "fieldtype": "Column Break",
-            "print_hide": 1,
-            "print_width": "50%",
-            "width": "50%"
-        },
-        {
-            "fieldname": "subscription_detail",
-            "fieldtype": "Section Break",
-            "label": "Auto Repeat Detail"
-        },
-        {
-            "fieldname": "auto_repeat",
-            "fieldtype": "Link",
-            "label": "Auto Repeat",
-            "no_copy": 1,
-            "options": "Auto Repeat",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "printing_settings",
-            "fieldtype": "Section Break",
-            "label": "Printing Settings"
-        },
-        {
-            "allow_on_submit": 1,
-            "fieldname": "letter_head",
-            "fieldtype": "Link",
-            "label": "Letter Head",
-            "options": "Letter Head",
-            "print_hide": 1
-        },
-        {
-            "allow_on_submit": 1,
-            "fieldname": "select_print_heading",
-            "fieldtype": "Link",
-            "label": "Print Heading",
-            "no_copy": 1,
-            "options": "Print Heading",
-            "print_hide": 1,
-            "report_hide": 1
-        },
-        {
-            "fieldname": "language",
-            "fieldtype": "Data",
-            "label": "Print Language",
-            "read_only": 1
-        },
-        {
-            "fieldname": "column_break_97",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "other_details",
-            "fieldtype": "HTML",
-            "hidden": 1,
-            "label": "Other Details",
-            "options": "<div class=\"columnHeading\">Other Details</div>",
-            "print_hide": 1,
-            "print_width": "30%",
-            "width": "30%"
-        },
-        {
-            "fieldname": "instructions",
-            "fieldtype": "Small Text",
-            "label": "Instructions"
-        },
-        {
-            "fieldname": "remarks",
-            "fieldtype": "Small Text",
-            "label": "Remarks",
-            "print_hide": 1
-        },
-        {
-            "collapsible": 1,
-            "collapsible_depends_on": "transporter_name",
-            "fieldname": "transporter_info",
-            "fieldtype": "Section Break",
-            "label": "Transporter Details",
-            "options": "fa fa-truck"
-        },
-        {
-            "fieldname": "transporter_name",
-            "fieldtype": "Data",
-            "label": "Transporter Name"
-        },
-        {
-            "fieldname": "column_break5",
-            "fieldtype": "Column Break",
-            "print_width": "50%",
-            "width": "50%"
-        },
-        {
-            "fieldname": "lr_no",
-            "fieldtype": "Data",
-            "label": "Vehicle Number",
-            "no_copy": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "fieldname": "lr_date",
-            "fieldtype": "Date",
-            "label": "Vehicle Date",
-            "no_copy": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "fieldname": "billing_address",
-            "fieldtype": "Link",
-            "label": "Select Billing Address",
-            "options": "Address"
-        },
-        {
-            "fieldname": "billing_address_display",
-            "fieldtype": "Small Text",
-            "label": "Billing Address",
-            "read_only": 1
-        },
-        {
-            "fetch_from": "supplier.represents_company",
-            "fieldname": "represents_company",
-            "fieldtype": "Link",
-            "ignore_user_permissions": 1,
-            "label": "Represents Company",
-            "options": "Company",
-            "read_only": 1
-        },
-        {
-            "default": "0",
-            "fieldname": "is_return",
-            "fieldtype": "Check",
-            "label": "Is Return",
-            "no_copy": 1,
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "depends_on": "is_return",
-            "fieldname": "return_against",
-            "fieldtype": "Link",
-            "label": "Return Against Subcontracting Receipt",
-            "no_copy": 1,
-            "options": "Subcontracting Receipt",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "column_break_39",
-            "fieldtype": "Column Break"
-        },
-        {
-            "depends_on": "eval:(!doc.__islocal && doc.is_return==0)",
-            "fieldname": "per_returned",
-            "fieldtype": "Percent",
-            "in_list_view": 1,
-            "label": "% Returned",
-            "no_copy": 1,
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "section_break_47",
-            "fieldtype": "Section Break"
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "accounting_dimensions_section",
-            "fieldtype": "Section Break",
-            "label": "Accounting Dimensions "
-        },
-        {
-            "fieldname": "cost_center",
-            "fieldtype": "Link",
-            "label": "Cost Center",
-            "options": "Cost Center"
-        },
-        {
-            "fieldname": "dimension_col_break",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "project",
-            "fieldtype": "Link",
-            "label": "Project",
-            "options": "Project"
-        },
-        {
-            "collapsible": 1,
-            "collapsible_depends_on": "total_additional_costs",
-            "depends_on": "eval:(doc.docstatus == 0 || doc.total_additional_costs)",
-            "fieldname": "additional_costs_section",
-            "fieldtype": "Section Break",
-            "label": "Additional Costs"
-        },
-        {
-            "default": "Qty",
-            "fieldname": "distribute_additional_costs_based_on",
-            "fieldtype": "Select",
-            "label": "Distribute Additional Costs Based On ",
-            "options": "Qty\nAmount"
-        },
-        {
-            "fieldname": "additional_costs",
-            "fieldtype": "Table",
-            "label": "Additional Costs",
-            "options": "Landed Cost Taxes and Charges"
-        },
-        {
-            "fieldname": "total_additional_costs",
-            "fieldtype": "Currency",
-            "label": "Total Additional Costs",
-            "print_hide_if_no_value": 1,
-            "read_only": 1
-        },
-        {
-            "default": "0",
-            "depends_on": "eval:doc.docstatus==0",
-            "fieldname": "set_posting_time",
-            "fieldtype": "Check",
-            "label": "Edit Posting Date and Time",
-            "print_hide": 1
-        }
-    ],
-    "in_create": 1,
-    "is_submittable": 1,
-    "links": [],
-    "modified": "2022-08-26 21:02:26.353870",
-    "modified_by": "Administrator",
-    "module": "Subcontracting",
-    "name": "Subcontracting Receipt",
-    "naming_rule": "By \"Naming Series\" field",
-    "owner": "Administrator",
-    "permissions": [
-        {
-            "amend": 1,
-            "cancel": 1,
-            "create": 1,
-            "delete": 1,
-            "email": 1,
-            "print": 1,
-            "read": 1,
-            "report": 1,
-            "role": "Stock Manager",
-            "share": 1,
-            "submit": 1,
-            "write": 1
-        },
-        {
-            "amend": 1,
-            "cancel": 1,
-            "create": 1,
-            "delete": 1,
-            "email": 1,
-            "print": 1,
-            "read": 1,
-            "report": 1,
-            "role": "Stock User",
-            "share": 1,
-            "submit": 1,
-            "write": 1
-        },
-        {
-            "amend": 1,
-            "cancel": 1,
-            "create": 1,
-            "delete": 1,
-            "email": 1,
-            "print": 1,
-            "read": 1,
-            "report": 1,
-            "role": "Purchase User",
-            "share": 1,
-            "submit": 1,
-            "write": 1
-        },
-        {
-            "read": 1,
-            "report": 1,
-            "role": "Accounts User"
-        },
-        {
-            "permlevel": 1,
-            "read": 1,
-            "role": "Stock Manager",
-            "write": 1
-        }
-    ],
-    "search_fields": "status, posting_date, supplier",
-    "show_name_in_global_search": 1,
-    "sort_field": "modified",
-    "sort_order": "DESC",
-    "states": [],
-    "timeline_field": "supplier",
-    "title_field": "title",
-    "track_changes": 1
+ "actions": [],
+ "autoname": "naming_series:",
+ "creation": "2022-04-18 11:20:44.226738",
+ "doctype": "DocType",
+ "document_type": "Document",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "title",
+  "naming_series",
+  "supplier",
+  "supplier_name",
+  "column_break1",
+  "company",
+  "posting_date",
+  "posting_time",
+  "set_posting_time",
+  "is_return",
+  "return_against",
+  "accounting_dimensions_section",
+  "cost_center",
+  "dimension_col_break",
+  "project",
+  "section_addresses",
+  "supplier_address",
+  "contact_person",
+  "address_display",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "col_break_address",
+  "shipping_address",
+  "shipping_address_display",
+  "billing_address",
+  "billing_address_display",
+  "sec_warehouse",
+  "set_warehouse",
+  "rejected_warehouse",
+  "col_break_warehouse",
+  "supplier_warehouse",
+  "items_section",
+  "items",
+  "section_break0",
+  "total_qty",
+  "column_break_27",
+  "total",
+  "raw_material_details",
+  "get_current_stock",
+  "supplied_items",
+  "additional_costs_section",
+  "distribute_additional_costs_based_on",
+  "additional_costs",
+  "total_additional_costs",
+  "section_break_46",
+  "in_words",
+  "bill_no",
+  "bill_date",
+  "more_info",
+  "status",
+  "column_break_39",
+  "per_returned",
+  "section_break_47",
+  "amended_from",
+  "range",
+  "column_break4",
+  "represents_company",
+  "subscription_detail",
+  "auto_repeat",
+  "printing_settings",
+  "letter_head",
+  "language",
+  "instructions",
+  "column_break_97",
+  "select_print_heading",
+  "other_details",
+  "remarks",
+  "transporter_info",
+  "transporter_name",
+  "column_break5",
+  "lr_no",
+  "lr_date"
+ ],
+ "fields": [
+  {
+   "allow_on_submit": 1,
+   "default": "{supplier_name}",
+   "fieldname": "title",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Title",
+   "no_copy": 1,
+   "print_hide": 1
+  },
+  {
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "no_copy": 1,
+   "options": "MAT-SCR-.YYYY.-\nMAT-SCR-RET-.YYYY.-",
+   "print_hide": 1,
+   "reqd": 1,
+   "set_only_once": 1
+  },
+  {
+   "bold": 1,
+   "fieldname": "supplier",
+   "fieldtype": "Link",
+   "in_global_search": 1,
+   "label": "Supplier",
+   "options": "Supplier",
+   "print_hide": 1,
+   "print_width": "150px",
+   "reqd": 1,
+   "search_index": 1,
+   "width": "150px"
+  },
+  {
+   "bold": 1,
+   "depends_on": "supplier",
+   "fetch_from": "supplier.supplier_name",
+   "fieldname": "supplier_name",
+   "fieldtype": "Data",
+   "in_global_search": 1,
+   "label": "Supplier Name",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "print_width": "50%",
+   "width": "50%"
+  },
+  {
+   "default": "Today",
+   "fieldname": "posting_date",
+   "fieldtype": "Date",
+   "in_list_view": 1,
+   "label": "Date",
+   "no_copy": 1,
+   "print_width": "100px",
+   "read_only_depends_on": "eval: !doc.set_posting_time",
+   "reqd": 1,
+   "search_index": 1,
+   "width": "100px"
+  },
+  {
+   "description": "Time at which materials were received",
+   "fieldname": "posting_time",
+   "fieldtype": "Time",
+   "label": "Posting Time",
+   "no_copy": 1,
+   "print_hide": 1,
+   "print_width": "100px",
+   "read_only_depends_on": "eval: !doc.set_posting_time",
+   "reqd": 1,
+   "width": "100px"
+  },
+  {
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_standard_filter": 1,
+   "label": "Company",
+   "options": "Company",
+   "print_hide": 1,
+   "print_width": "150px",
+   "remember_last_selected_value": 1,
+   "reqd": 1,
+   "width": "150px"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "section_addresses",
+   "fieldtype": "Section Break",
+   "label": "Address and Contact"
+  },
+  {
+   "fieldname": "supplier_address",
+   "fieldtype": "Link",
+   "label": "Select Supplier Address",
+   "options": "Address",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "label": "Contact Person",
+   "options": "Contact",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "label": "Address",
+   "read_only": 1
+  },
+  {
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "in_global_search": 1,
+   "label": "Contact",
+   "read_only": 1
+  },
+  {
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "label": "Mobile No",
+   "read_only": 1
+  },
+  {
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "label": "Contact Email",
+   "options": "Email",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "col_break_address",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "shipping_address",
+   "fieldtype": "Link",
+   "label": "Select Shipping Address",
+   "options": "Address",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "shipping_address_display",
+   "fieldtype": "Small Text",
+   "label": "Shipping Address",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "sec_warehouse",
+   "fieldtype": "Section Break"
+  },
+  {
+   "description": "Sets 'Accepted Warehouse' in each row of the Items table.",
+   "fieldname": "set_warehouse",
+   "fieldtype": "Link",
+   "label": "Accepted Warehouse",
+   "options": "Warehouse",
+   "print_hide": 1
+  },
+  {
+   "depends_on": "eval: !doc.is_return",
+   "description": "Sets 'Rejected Warehouse' in each row of the Items table.",
+   "fieldname": "rejected_warehouse",
+   "fieldtype": "Link",
+   "label": "Rejected Warehouse",
+   "no_copy": 1,
+   "options": "Warehouse",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "col_break_warehouse",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "supplier_warehouse",
+   "fieldtype": "Link",
+   "label": "Supplier Warehouse",
+   "no_copy": 1,
+   "options": "Warehouse",
+   "print_hide": 1,
+   "print_width": "50px",
+   "width": "50px"
+  },
+  {
+   "fieldname": "items_section",
+   "fieldtype": "Section Break",
+   "options": "fa fa-shopping-cart"
+  },
+  {
+   "allow_bulk_edit": 1,
+   "fieldname": "items",
+   "fieldtype": "Table",
+   "label": "Items",
+   "options": "Subcontracting Receipt Item",
+   "reqd": 1
+  },
+  {
+   "depends_on": "supplied_items",
+   "fieldname": "get_current_stock",
+   "fieldtype": "Button",
+   "label": "Get Current Stock",
+   "options": "get_current_stock",
+   "print_hide": 1
+  },
+  {
+   "collapsible": 1,
+   "collapsible_depends_on": "supplied_items",
+   "depends_on": "supplied_items",
+   "fieldname": "raw_material_details",
+   "fieldtype": "Section Break",
+   "label": "Raw Materials Consumed",
+   "options": "fa fa-table",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "supplied_items",
+   "fieldtype": "Table",
+   "label": "Consumed Items",
+   "no_copy": 1,
+   "options": "Subcontracting Receipt Supplied Item",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "section_break0",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "total_qty",
+   "fieldtype": "Float",
+   "label": "Total Quantity",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_27",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "total",
+   "fieldtype": "Currency",
+   "label": "Total",
+   "options": "currency",
+   "read_only": 1
+  },
+  {
+   "fieldname": "section_break_46",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "in_words",
+   "fieldtype": "Data",
+   "label": "In Words",
+   "length": 240,
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "bill_no",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Bill No",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "bill_date",
+   "fieldtype": "Date",
+   "hidden": 1,
+   "label": "Bill Date",
+   "print_hide": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "label": "More Information",
+   "options": "fa fa-file-text"
+  },
+  {
+   "default": "Draft",
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "in_standard_filter": 1,
+   "label": "Status",
+   "no_copy": 1,
+   "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
+   "print_hide": 1,
+   "print_width": "150px",
+   "read_only": 1,
+   "reqd": 1,
+   "search_index": 1,
+   "width": "150px"
+  },
+  {
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "ignore_user_permissions": 1,
+   "label": "Amended From",
+   "no_copy": 1,
+   "options": "Subcontracting Receipt",
+   "print_hide": 1,
+   "print_width": "150px",
+   "read_only": 1,
+   "width": "150px"
+  },
+  {
+   "fieldname": "range",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Range",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "column_break4",
+   "fieldtype": "Column Break",
+   "print_hide": 1,
+   "print_width": "50%",
+   "width": "50%"
+  },
+  {
+   "fieldname": "subscription_detail",
+   "fieldtype": "Section Break",
+   "label": "Auto Repeat Detail"
+  },
+  {
+   "fieldname": "auto_repeat",
+   "fieldtype": "Link",
+   "label": "Auto Repeat",
+   "no_copy": 1,
+   "options": "Auto Repeat",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "printing_settings",
+   "fieldtype": "Section Break",
+   "label": "Printing Settings"
+  },
+  {
+   "allow_on_submit": 1,
+   "fieldname": "letter_head",
+   "fieldtype": "Link",
+   "label": "Letter Head",
+   "options": "Letter Head",
+   "print_hide": 1
+  },
+  {
+   "allow_on_submit": 1,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "label": "Print Heading",
+   "no_copy": 1,
+   "options": "Print Heading",
+   "print_hide": 1,
+   "report_hide": 1
+  },
+  {
+   "fieldname": "language",
+   "fieldtype": "Data",
+   "label": "Print Language",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_97",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "other_details",
+   "fieldtype": "HTML",
+   "hidden": 1,
+   "label": "Other Details",
+   "options": "<div class=\"columnHeading\">Other Details</div>",
+   "print_hide": 1,
+   "print_width": "30%",
+   "width": "30%"
+  },
+  {
+   "fieldname": "instructions",
+   "fieldtype": "Small Text",
+   "label": "Instructions"
+  },
+  {
+   "fieldname": "remarks",
+   "fieldtype": "Small Text",
+   "label": "Remarks",
+   "print_hide": 1
+  },
+  {
+   "collapsible": 1,
+   "collapsible_depends_on": "transporter_name",
+   "fieldname": "transporter_info",
+   "fieldtype": "Section Break",
+   "label": "Transporter Details",
+   "options": "fa fa-truck"
+  },
+  {
+   "fieldname": "transporter_name",
+   "fieldtype": "Data",
+   "label": "Transporter Name"
+  },
+  {
+   "fieldname": "column_break5",
+   "fieldtype": "Column Break",
+   "print_width": "50%",
+   "width": "50%"
+  },
+  {
+   "fieldname": "lr_no",
+   "fieldtype": "Data",
+   "label": "Vehicle Number",
+   "no_copy": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "fieldname": "lr_date",
+   "fieldtype": "Date",
+   "label": "Vehicle Date",
+   "no_copy": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "fieldname": "billing_address",
+   "fieldtype": "Link",
+   "label": "Select Billing Address",
+   "options": "Address"
+  },
+  {
+   "fieldname": "billing_address_display",
+   "fieldtype": "Small Text",
+   "label": "Billing Address",
+   "read_only": 1
+  },
+  {
+   "fetch_from": "supplier.represents_company",
+   "fieldname": "represents_company",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "label": "Represents Company",
+   "options": "Company",
+   "read_only": 1
+  },
+  {
+   "default": "0",
+   "fieldname": "is_return",
+   "fieldtype": "Check",
+   "label": "Is Return",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "depends_on": "is_return",
+   "fieldname": "return_against",
+   "fieldtype": "Link",
+   "label": "Return Against Subcontracting Receipt",
+   "no_copy": 1,
+   "options": "Subcontracting Receipt",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_39",
+   "fieldtype": "Column Break"
+  },
+  {
+   "depends_on": "eval:(!doc.__islocal && doc.is_return==0)",
+   "fieldname": "per_returned",
+   "fieldtype": "Percent",
+   "in_list_view": 1,
+   "label": "% Returned",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "section_break_47",
+   "fieldtype": "Section Break"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "accounting_dimensions_section",
+   "fieldtype": "Section Break",
+   "label": "Accounting Dimensions "
+  },
+  {
+   "fieldname": "cost_center",
+   "fieldtype": "Link",
+   "label": "Cost Center",
+   "options": "Cost Center"
+  },
+  {
+   "fieldname": "dimension_col_break",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "project",
+   "fieldtype": "Link",
+   "label": "Project",
+   "options": "Project"
+  },
+  {
+   "collapsible": 1,
+   "collapsible_depends_on": "total_additional_costs",
+   "depends_on": "eval:(doc.docstatus == 0 || doc.total_additional_costs)",
+   "fieldname": "additional_costs_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Costs"
+  },
+  {
+   "default": "Qty",
+   "fieldname": "distribute_additional_costs_based_on",
+   "fieldtype": "Select",
+   "label": "Distribute Additional Costs Based On ",
+   "options": "Qty\nAmount"
+  },
+  {
+   "fieldname": "additional_costs",
+   "fieldtype": "Table",
+   "label": "Additional Costs",
+   "options": "Landed Cost Taxes and Charges"
+  },
+  {
+   "fieldname": "total_additional_costs",
+   "fieldtype": "Currency",
+   "label": "Total Additional Costs",
+   "print_hide_if_no_value": 1,
+   "read_only": 1
+  },
+  {
+   "default": "0",
+   "depends_on": "eval:doc.docstatus==0",
+   "fieldname": "set_posting_time",
+   "fieldtype": "Check",
+   "label": "Edit Posting Date and Time",
+   "print_hide": 1
+  }
+ ],
+ "in_create": 1,
+ "is_submittable": 1,
+ "links": [],
+ "modified": "2022-11-16 14:18:57.001239",
+ "modified_by": "Administrator",
+ "module": "Subcontracting",
+ "name": "Subcontracting Receipt",
+ "naming_rule": "By \"Naming Series\" field",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Stock Manager",
+   "share": 1,
+   "submit": 1,
+   "write": 1
+  },
+  {
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Stock User",
+   "share": 1,
+   "submit": 1,
+   "write": 1
+  },
+  {
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Purchase User",
+   "share": 1,
+   "submit": 1,
+   "write": 1
+  },
+  {
+   "read": 1,
+   "report": 1,
+   "role": "Accounts User"
+  },
+  {
+   "permlevel": 1,
+   "read": 1,
+   "role": "Stock Manager",
+   "write": 1
+  }
+ ],
+ "search_fields": "status, posting_date, supplier",
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "timeline_field": "supplier",
+ "title_field": "title",
+ "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
index fd86895..4b64e4b 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
@@ -1,488 +1,490 @@
 {
-    "actions": [],
-    "autoname": "hash",
-    "creation": "2022-04-13 16:05:55.395695",
-    "doctype": "DocType",
-    "document_type": "Document",
-    "editable_grid": 1,
-    "engine": "InnoDB",
-    "field_order": [
-        "item_code",
-        "column_break_2",
-        "item_name",
-        "section_break_4",
-        "description",
-        "brand",
-        "image_column",
-        "image",
-        "image_view",
-        "received_and_accepted",
-        "received_qty",
-        "qty",
-        "rejected_qty",
-        "returned_qty",
-        "col_break2",
-        "stock_uom",
-        "conversion_factor",
-        "tracking_section",
-        "col_break_tracking_section",
-        "rate_and_amount",
-        "rate",
-        "amount",
-        "recalculate_rate",
-        "column_break_19",
-        "rm_cost_per_qty",
-        "service_cost_per_qty",
-        "additional_cost_per_qty",
-        "rm_supp_cost",
-        "warehouse_and_reference",
-        "warehouse",
-        "rejected_warehouse",
-        "subcontracting_order",
-        "column_break_40",
-        "schedule_date",
-        "quality_inspection",
-        "subcontracting_order_item",
-        "subcontracting_receipt_item",
-        "section_break_45",
-        "bom",
-        "serial_no",
-        "col_break5",
-        "batch_no",
-        "rejected_serial_no",
-        "manufacture_details",
-        "manufacturer",
-        "column_break_16",
-        "manufacturer_part_no",
-        "accounting_details_section",
-        "expense_account",
-        "accounting_dimensions_section",
-        "cost_center",
-        "dimension_col_break",
-        "project",
-        "section_break_80",
-        "page_break"
-    ],
-    "fields": [
-        {
-            "bold": 1,
-            "columns": 3,
-            "fieldname": "item_code",
-            "fieldtype": "Link",
-            "in_global_search": 1,
-            "in_list_view": 1,
-            "label": "Item Code",
-            "options": "Item",
-            "print_width": "100px",
-            "reqd": 1,
-            "search_index": 1,
-            "width": "100px"
-        },
-        {
-            "fieldname": "column_break_2",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "item_name",
-            "fieldtype": "Data",
-            "in_global_search": 1,
-            "label": "Item Name",
-            "print_hide": 1,
-            "reqd": 1
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "section_break_4",
-            "fieldtype": "Section Break",
-            "label": "Description"
-        },
-        {
-            "fieldname": "description",
-            "fieldtype": "Text Editor",
-            "label": "Description",
-            "print_width": "300px",
-            "reqd": 1,
-            "width": "300px"
-        },
-        {
-            "fieldname": "image",
-            "fieldtype": "Attach",
-            "hidden": 1,
-            "label": "Image"
-        },
-        {
-            "fieldname": "image_view",
-            "fieldtype": "Image",
-            "label": "Image View",
-            "options": "image",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "received_and_accepted",
-            "fieldtype": "Section Break",
-            "label": "Received and Accepted"
-        },
-        {
-            "bold": 1,
-            "default": "0",
-            "fieldname": "received_qty",
-            "fieldtype": "Float",
-            "label": "Received Quantity",
-            "no_copy": 1,
-            "print_hide": 1,
-            "print_width": "100px",
-            "read_only": 1,
-            "reqd": 1,
-            "width": "100px"
-        },
-        {
-            "columns": 2,
-            "fieldname": "qty",
-            "fieldtype": "Float",
-            "in_list_view": 1,
-            "label": "Accepted Quantity",
-            "no_copy": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "columns": 1,
-            "fieldname": "rejected_qty",
-            "fieldtype": "Float",
-            "in_list_view": 1,
-            "label": "Rejected Quantity",
-            "no_copy": 1,
-            "print_hide": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "fieldname": "col_break2",
-            "fieldtype": "Column Break",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "stock_uom",
-            "fieldtype": "Link",
-            "label": "Stock UOM",
-            "options": "UOM",
-            "print_hide": 1,
-            "print_width": "100px",
-            "read_only": 1,
-            "reqd": 1,
-            "width": "100px"
-        },
-        {
-            "default": "1",
-            "fieldname": "conversion_factor",
-            "fieldtype": "Float",
-            "hidden": 1,
-            "label": "Conversion Factor",
-            "read_only": 1
-        },
-        {
-            "fieldname": "rate_and_amount",
-            "fieldtype": "Section Break",
-            "label": "Rate and Amount"
-        },
-        {
-            "bold": 1,
-            "columns": 2,
-            "fieldname": "rate",
-            "fieldtype": "Currency",
-            "in_list_view": 1,
-            "label": "Rate",
-            "options": "currency",
-            "print_width": "100px",
-            "read_only": 1,
-            "read_only_depends_on": "eval: doc.recalculate_rate",
-            "width": "100px"
-        },
-        {
-            "fieldname": "amount",
-            "fieldtype": "Currency",
-            "in_list_view": 1,
-            "label": "Amount",
-            "options": "currency",
-            "read_only": 1
-        },
-        {
-            "fieldname": "column_break_19",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "rm_cost_per_qty",
-            "fieldtype": "Currency",
-            "label": "Raw Material Cost Per Qty",
-            "no_copy": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "service_cost_per_qty",
-            "fieldtype": "Currency",
-            "label": "Service Cost Per Qty",
-            "read_only": 1,
-            "reqd": 1
-        },
-        {
-            "default": "0",
-            "fieldname": "additional_cost_per_qty",
-            "fieldtype": "Currency",
-            "label": "Additional Cost Per Qty",
-            "read_only": 1
-        },
-        {
-            "fieldname": "warehouse_and_reference",
-            "fieldtype": "Section Break",
-            "label": "Warehouse and Reference"
-        },
-        {
-            "bold": 1,
-            "fieldname": "warehouse",
-            "fieldtype": "Link",
-            "in_list_view": 1,
-            "label": "Accepted Warehouse",
-            "options": "Warehouse",
-            "print_hide": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "fieldname": "rejected_warehouse",
-            "fieldtype": "Link",
-            "label": "Rejected Warehouse",
-            "no_copy": 1,
-            "options": "Warehouse",
-            "print_hide": 1,
-            "print_width": "100px",
-            "width": "100px"
-        },
-        {
-            "depends_on": "eval:!doc.__islocal",
-            "fieldname": "quality_inspection",
-            "fieldtype": "Link",
-            "label": "Quality Inspection",
-            "no_copy": 1,
-            "options": "Quality Inspection",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "column_break_40",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "subcontracting_order",
-            "fieldtype": "Link",
-            "label": "Subcontracting Order",
-            "no_copy": 1,
-            "options": "Subcontracting Order",
-            "print_width": "150px",
-            "read_only": 1,
-            "search_index": 1,
-            "width": "150px"
-        },
-        {
-            "fieldname": "schedule_date",
-            "fieldtype": "Date",
-            "label": "Required By",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "section_break_45",
-            "fieldtype": "Section Break"
-        },
-        {
-            "depends_on": "eval:!doc.is_fixed_asset",
-            "fieldname": "serial_no",
-            "fieldtype": "Small Text",
-            "in_list_view": 1,
-            "label": "Serial No",
-            "no_copy": 1
-        },
-        {
-            "depends_on": "eval:!doc.is_fixed_asset",
-            "fieldname": "batch_no",
-            "fieldtype": "Link",
-            "in_list_view": 1,
-            "label": "Batch No",
-            "no_copy": 1,
-            "options": "Batch",
-            "print_hide": 1
-        },
-        {
-            "depends_on": "eval:!doc.is_fixed_asset",
-            "fieldname": "rejected_serial_no",
-            "fieldtype": "Small Text",
-            "label": "Rejected Serial No",
-            "no_copy": 1,
-            "print_hide": 1
-        },
-        {
-            "fieldname": "subcontracting_order_item",
-            "fieldtype": "Data",
-            "hidden": 1,
-            "label": "Subcontracting Order Item",
-            "no_copy": 1,
-            "print_hide": 1,
-            "print_width": "150px",
-            "read_only": 1,
-            "search_index": 1,
-            "width": "150px"
-        },
-        {
-            "fieldname": "col_break5",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "bom",
-            "fieldtype": "Link",
-            "label": "BOM",
-            "no_copy": 1,
-            "options": "BOM",
-            "print_hide": 1
-        },
-        {
-            "fetch_from": "item_code.brand",
-            "fieldname": "brand",
-            "fieldtype": "Link",
-            "hidden": 1,
-            "label": "Brand",
-            "options": "Brand",
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "rm_supp_cost",
-            "fieldtype": "Currency",
-            "hidden": 1,
-            "label": "Raw Materials Supplied Cost",
-            "no_copy": 1,
-            "options": "Company:company:default_currency",
-            "print_hide": 1,
-            "print_width": "150px",
-            "read_only": 1,
-            "width": "150px"
-        },
-        {
-            "fieldname": "expense_account",
-            "fieldtype": "Link",
-            "label": "Expense Account",
-            "options": "Account"
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "manufacture_details",
-            "fieldtype": "Section Break",
-            "label": "Manufacture"
-        },
-        {
-            "fieldname": "manufacturer",
-            "fieldtype": "Link",
-            "label": "Manufacturer",
-            "options": "Manufacturer"
-        },
-        {
-            "fieldname": "column_break_16",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "manufacturer_part_no",
-            "fieldtype": "Data",
-            "label": "Manufacturer Part Number"
-        },
-        {
-            "fieldname": "subcontracting_receipt_item",
-            "fieldtype": "Data",
-            "hidden": 1,
-            "label": "Subcontracting Receipt Item",
-            "no_copy": 1,
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "collapsible": 1,
-            "fieldname": "image_column",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "tracking_section",
-            "fieldtype": "Section Break"
-        },
-        {
-            "fieldname": "col_break_tracking_section",
-            "fieldtype": "Column Break"
-        },
-        {
-            "fieldname": "accounting_dimensions_section",
-            "fieldtype": "Section Break",
-            "label": "Accounting Dimensions"
-        },
-        {
-            "fieldname": "project",
-            "fieldtype": "Link",
-            "label": "Project",
-            "options": "Project",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "dimension_col_break",
-            "fieldtype": "Column Break"
-        },
-        {
-            "default": ":Company",
-            "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
-            "fieldname": "cost_center",
-            "fieldtype": "Link",
-            "label": "Cost Center",
-            "options": "Cost Center",
-            "print_hide": 1
-        },
-        {
-            "fieldname": "section_break_80",
-            "fieldtype": "Section Break"
-        },
-        {
-            "allow_on_submit": 1,
-            "default": "0",
-            "fieldname": "page_break",
-            "fieldtype": "Check",
-            "label": "Page Break",
-            "print_hide": 1
-        },
-        {
-            "depends_on": "returned_qty",
-            "fieldname": "returned_qty",
-            "fieldtype": "Float",
-            "label": "Returned Qty",
-            "no_copy": 1,
-            "print_hide": 1,
-            "read_only": 1
-        },
-        {
-            "fieldname": "accounting_details_section",
-            "fieldtype": "Section Break",
-            "label": "Accounting Details"
-        },
-        {
-            "default": "1",
-            "fieldname": "recalculate_rate",
-            "fieldtype": "Check",
-            "label": "Recalculate Rate"
-        }
-    ],
-    "idx": 1,
-    "istable": 1,
-    "links": [],
-    "modified": "2022-08-20 17:16:48.269164",
-    "modified_by": "Administrator",
-    "module": "Subcontracting",
-    "name": "Subcontracting Receipt Item",
-    "naming_rule": "Random",
-    "owner": "Administrator",
-    "permissions": [],
-    "quick_entry": 1,
-    "sort_field": "modified",
-    "sort_order": "DESC",
-    "states": []
+ "actions": [],
+ "autoname": "hash",
+ "creation": "2022-04-13 16:05:55.395695",
+ "doctype": "DocType",
+ "document_type": "Document",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "item_code",
+  "column_break_2",
+  "item_name",
+  "section_break_4",
+  "description",
+  "brand",
+  "image_column",
+  "image",
+  "image_view",
+  "received_and_accepted",
+  "received_qty",
+  "qty",
+  "rejected_qty",
+  "returned_qty",
+  "col_break2",
+  "stock_uom",
+  "conversion_factor",
+  "tracking_section",
+  "col_break_tracking_section",
+  "rate_and_amount",
+  "rate",
+  "amount",
+  "recalculate_rate",
+  "column_break_19",
+  "rm_cost_per_qty",
+  "service_cost_per_qty",
+  "additional_cost_per_qty",
+  "rm_supp_cost",
+  "warehouse_and_reference",
+  "warehouse",
+  "rejected_warehouse",
+  "subcontracting_order",
+  "column_break_40",
+  "schedule_date",
+  "quality_inspection",
+  "subcontracting_order_item",
+  "subcontracting_receipt_item",
+  "section_break_45",
+  "bom",
+  "serial_no",
+  "col_break5",
+  "batch_no",
+  "rejected_serial_no",
+  "manufacture_details",
+  "manufacturer",
+  "column_break_16",
+  "manufacturer_part_no",
+  "accounting_details_section",
+  "expense_account",
+  "accounting_dimensions_section",
+  "cost_center",
+  "dimension_col_break",
+  "project",
+  "section_break_80",
+  "page_break"
+ ],
+ "fields": [
+  {
+   "bold": 1,
+   "columns": 3,
+   "fieldname": "item_code",
+   "fieldtype": "Link",
+   "in_global_search": 1,
+   "in_list_view": 1,
+   "label": "Item Code",
+   "options": "Item",
+   "print_width": "100px",
+   "reqd": 1,
+   "search_index": 1,
+   "width": "100px"
+  },
+  {
+   "fieldname": "column_break_2",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "item_name",
+   "fieldtype": "Data",
+   "in_global_search": 1,
+   "label": "Item Name",
+   "print_hide": 1,
+   "reqd": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "section_break_4",
+   "fieldtype": "Section Break",
+   "label": "Description"
+  },
+  {
+   "fieldname": "description",
+   "fieldtype": "Text Editor",
+   "label": "Description",
+   "print_width": "300px",
+   "reqd": 1,
+   "width": "300px"
+  },
+  {
+   "fieldname": "image",
+   "fieldtype": "Attach",
+   "hidden": 1,
+   "label": "Image"
+  },
+  {
+   "fieldname": "image_view",
+   "fieldtype": "Image",
+   "label": "Image View",
+   "options": "image",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "received_and_accepted",
+   "fieldtype": "Section Break",
+   "label": "Received and Accepted"
+  },
+  {
+   "bold": 1,
+   "default": "0",
+   "fieldname": "received_qty",
+   "fieldtype": "Float",
+   "label": "Received Quantity",
+   "no_copy": 1,
+   "print_hide": 1,
+   "print_width": "100px",
+   "read_only": 1,
+   "reqd": 1,
+   "width": "100px"
+  },
+  {
+   "columns": 2,
+   "fieldname": "qty",
+   "fieldtype": "Float",
+   "in_list_view": 1,
+   "label": "Accepted Quantity",
+   "no_copy": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "columns": 1,
+   "depends_on": "eval: !parent.is_return",
+   "fieldname": "rejected_qty",
+   "fieldtype": "Float",
+   "in_list_view": 1,
+   "label": "Rejected Quantity",
+   "no_copy": 1,
+   "print_hide": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "fieldname": "col_break2",
+   "fieldtype": "Column Break",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "stock_uom",
+   "fieldtype": "Link",
+   "label": "Stock UOM",
+   "options": "UOM",
+   "print_hide": 1,
+   "print_width": "100px",
+   "read_only": 1,
+   "reqd": 1,
+   "width": "100px"
+  },
+  {
+   "default": "1",
+   "fieldname": "conversion_factor",
+   "fieldtype": "Float",
+   "hidden": 1,
+   "label": "Conversion Factor",
+   "read_only": 1
+  },
+  {
+   "fieldname": "rate_and_amount",
+   "fieldtype": "Section Break",
+   "label": "Rate and Amount"
+  },
+  {
+   "bold": 1,
+   "columns": 2,
+   "fieldname": "rate",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Rate",
+   "options": "currency",
+   "print_width": "100px",
+   "read_only": 1,
+   "read_only_depends_on": "eval: doc.recalculate_rate",
+   "width": "100px"
+  },
+  {
+   "fieldname": "amount",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Amount",
+   "options": "currency",
+   "read_only": 1
+  },
+  {
+   "fieldname": "column_break_19",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "rm_cost_per_qty",
+   "fieldtype": "Currency",
+   "label": "Raw Material Cost Per Qty",
+   "no_copy": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "service_cost_per_qty",
+   "fieldtype": "Currency",
+   "label": "Service Cost Per Qty",
+   "read_only": 1,
+   "reqd": 1
+  },
+  {
+   "default": "0",
+   "fieldname": "additional_cost_per_qty",
+   "fieldtype": "Currency",
+   "label": "Additional Cost Per Qty",
+   "read_only": 1
+  },
+  {
+   "fieldname": "warehouse_and_reference",
+   "fieldtype": "Section Break",
+   "label": "Warehouse and Reference"
+  },
+  {
+   "bold": 1,
+   "fieldname": "warehouse",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Accepted Warehouse",
+   "options": "Warehouse",
+   "print_hide": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "depends_on": "eval: !parent.is_return",
+   "fieldname": "rejected_warehouse",
+   "fieldtype": "Link",
+   "label": "Rejected Warehouse",
+   "no_copy": 1,
+   "options": "Warehouse",
+   "print_hide": 1,
+   "print_width": "100px",
+   "width": "100px"
+  },
+  {
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "quality_inspection",
+   "fieldtype": "Link",
+   "label": "Quality Inspection",
+   "no_copy": 1,
+   "options": "Quality Inspection",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "column_break_40",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "subcontracting_order",
+   "fieldtype": "Link",
+   "label": "Subcontracting Order",
+   "no_copy": 1,
+   "options": "Subcontracting Order",
+   "print_width": "150px",
+   "read_only": 1,
+   "search_index": 1,
+   "width": "150px"
+  },
+  {
+   "fieldname": "schedule_date",
+   "fieldtype": "Date",
+   "label": "Required By",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "section_break_45",
+   "fieldtype": "Section Break"
+  },
+  {
+   "depends_on": "eval:!doc.is_fixed_asset",
+   "fieldname": "serial_no",
+   "fieldtype": "Small Text",
+   "in_list_view": 1,
+   "label": "Serial No",
+   "no_copy": 1
+  },
+  {
+   "depends_on": "eval:!doc.is_fixed_asset",
+   "fieldname": "batch_no",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Batch No",
+   "no_copy": 1,
+   "options": "Batch",
+   "print_hide": 1
+  },
+  {
+   "depends_on": "eval: !parent.is_return",
+   "fieldname": "rejected_serial_no",
+   "fieldtype": "Small Text",
+   "label": "Rejected Serial No",
+   "no_copy": 1,
+   "print_hide": 1
+  },
+  {
+   "fieldname": "subcontracting_order_item",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Subcontracting Order Item",
+   "no_copy": 1,
+   "print_hide": 1,
+   "print_width": "150px",
+   "read_only": 1,
+   "search_index": 1,
+   "width": "150px"
+  },
+  {
+   "fieldname": "col_break5",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "bom",
+   "fieldtype": "Link",
+   "label": "BOM",
+   "no_copy": 1,
+   "options": "BOM",
+   "print_hide": 1
+  },
+  {
+   "fetch_from": "item_code.brand",
+   "fieldname": "brand",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "label": "Brand",
+   "options": "Brand",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "rm_supp_cost",
+   "fieldtype": "Currency",
+   "hidden": 1,
+   "label": "Raw Materials Supplied Cost",
+   "no_copy": 1,
+   "options": "Company:company:default_currency",
+   "print_hide": 1,
+   "print_width": "150px",
+   "read_only": 1,
+   "width": "150px"
+  },
+  {
+   "fieldname": "expense_account",
+   "fieldtype": "Link",
+   "label": "Expense Account",
+   "options": "Account"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "manufacture_details",
+   "fieldtype": "Section Break",
+   "label": "Manufacture"
+  },
+  {
+   "fieldname": "manufacturer",
+   "fieldtype": "Link",
+   "label": "Manufacturer",
+   "options": "Manufacturer"
+  },
+  {
+   "fieldname": "column_break_16",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "manufacturer_part_no",
+   "fieldtype": "Data",
+   "label": "Manufacturer Part Number"
+  },
+  {
+   "fieldname": "subcontracting_receipt_item",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Subcontracting Receipt Item",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "image_column",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "tracking_section",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "col_break_tracking_section",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "accounting_dimensions_section",
+   "fieldtype": "Section Break",
+   "label": "Accounting Dimensions"
+  },
+  {
+   "fieldname": "project",
+   "fieldtype": "Link",
+   "label": "Project",
+   "options": "Project",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "dimension_col_break",
+   "fieldtype": "Column Break"
+  },
+  {
+   "default": ":Company",
+   "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
+   "fieldname": "cost_center",
+   "fieldtype": "Link",
+   "label": "Cost Center",
+   "options": "Cost Center",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "section_break_80",
+   "fieldtype": "Section Break"
+  },
+  {
+   "allow_on_submit": 1,
+   "default": "0",
+   "fieldname": "page_break",
+   "fieldtype": "Check",
+   "label": "Page Break",
+   "print_hide": 1
+  },
+  {
+   "depends_on": "returned_qty",
+   "fieldname": "returned_qty",
+   "fieldtype": "Float",
+   "label": "Returned Qty",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "accounting_details_section",
+   "fieldtype": "Section Break",
+   "label": "Accounting Details"
+  },
+  {
+   "default": "1",
+   "fieldname": "recalculate_rate",
+   "fieldtype": "Check",
+   "label": "Recalculate Rate"
+  }
+ ],
+ "idx": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2022-11-16 14:21:26.125815",
+ "modified_by": "Administrator",
+ "module": "Subcontracting",
+ "name": "Subcontracting Receipt Item",
+ "naming_rule": "Random",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
 }
\ No newline at end of file