Merge pull request #33808 from dj12djdjs/fix-lead-rename

fix: make title field readonly
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 73aae33..d70977c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -32,8 +32,8 @@
       - id: black
         additional_dependencies: ['click==8.0.4']
 
-  - repo: https://github.com/timothycrosley/isort
-    rev: 5.9.1
+  - repo: https://github.com/PyCQA/isort
+    rev: 5.12.0
     hooks:
       - id: isort
         exclude: ".*setup.py$"
diff --git a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
index d25016f..54ffe21 100644
--- a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
+++ b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
@@ -28,9 +28,14 @@
 
 
 class CostCenterAllocation(Document):
+	def __init__(self, *args, **kwargs):
+		super(CostCenterAllocation, self).__init__(*args, **kwargs)
+		self._skip_from_date_validation = False
+
 	def validate(self):
 		self.validate_total_allocation_percentage()
-		self.validate_from_date_based_on_existing_gle()
+		if not self._skip_from_date_validation:
+			self.validate_from_date_based_on_existing_gle()
 		self.validate_backdated_allocation()
 		self.validate_main_cost_center()
 		self.validate_child_cost_centers()
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index 30a3201..21f27ae 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -8,7 +8,7 @@
 frappe.ui.form.on("Journal Entry", {
 	setup: function(frm) {
 		frm.add_fetch("bank_account", "account", "account");
-		frm.ignore_doctypes_on_cancel_all = ['Sales Invoice', 'Purchase Invoice'];
+		frm.ignore_doctypes_on_cancel_all = ['Sales Invoice', 'Purchase Invoice', 'Journal Entry'];
 	},
 
 	refresh: function(frm) {
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index 12c0b7a..154fdc0 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -69,6 +69,10 @@
 
 	def get_jv_entries(self):
 		condition = self.get_conditions()
+
+		if self.get("cost_center"):
+			condition += f" and t2.cost_center = '{self.cost_center}' "
+
 		dr_or_cr = (
 			"credit_in_account_currency"
 			if erpnext.get_party_account_type(self.party_type) == "Receivable"
diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
index 2ba90b4..00e3934 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
@@ -747,6 +747,73 @@
 		self.assertEqual(len(pr.get("invoices")), 0)
 		self.assertEqual(len(pr.get("payments")), 0)
 
+	def test_cost_center_filter_on_vouchers(self):
+		"""
+		Test Cost Center filter is applied on Invoices, Payment Entries and Journals
+		"""
+		transaction_date = nowdate()
+		rate = 100
+
+		# 'Main - PR' Cost Center
+		si1 = self.create_sales_invoice(
+			qty=1, rate=rate, posting_date=transaction_date, do_not_submit=True
+		)
+		si1.cost_center = self.main_cc.name
+		si1.submit()
+
+		pe1 = self.create_payment_entry(posting_date=transaction_date, amount=rate)
+		pe1.cost_center = self.main_cc.name
+		pe1 = pe1.save().submit()
+
+		je1 = self.create_journal_entry(self.bank, self.debit_to, 100, transaction_date)
+		je1.accounts[0].cost_center = self.main_cc.name
+		je1.accounts[1].cost_center = self.main_cc.name
+		je1.accounts[1].party_type = "Customer"
+		je1.accounts[1].party = self.customer
+		je1 = je1.save().submit()
+
+		# 'Sub - PR' Cost Center
+		si2 = self.create_sales_invoice(
+			qty=1, rate=rate, posting_date=transaction_date, do_not_submit=True
+		)
+		si2.cost_center = self.sub_cc.name
+		si2.submit()
+
+		pe2 = self.create_payment_entry(posting_date=transaction_date, amount=rate)
+		pe2.cost_center = self.sub_cc.name
+		pe2 = pe2.save().submit()
+
+		je2 = self.create_journal_entry(self.bank, self.debit_to, 100, transaction_date)
+		je2.accounts[0].cost_center = self.sub_cc.name
+		je2.accounts[1].cost_center = self.sub_cc.name
+		je2.accounts[1].party_type = "Customer"
+		je2.accounts[1].party = self.customer
+		je2 = je2.save().submit()
+
+		pr = self.create_payment_reconciliation()
+		pr.cost_center = self.main_cc.name
+
+		pr.get_unreconciled_entries()
+
+		# check PR tool output
+		self.assertEqual(len(pr.get("invoices")), 1)
+		self.assertEqual(pr.get("invoices")[0].get("invoice_number"), si1.name)
+		self.assertEqual(len(pr.get("payments")), 2)
+		payment_vouchers = [x.get("reference_name") for x in pr.get("payments")]
+		self.assertCountEqual(payment_vouchers, [pe1.name, je1.name])
+
+		# Change cost center
+		pr.cost_center = self.sub_cc.name
+
+		pr.get_unreconciled_entries()
+
+		# check PR tool output
+		self.assertEqual(len(pr.get("invoices")), 1)
+		self.assertEqual(pr.get("invoices")[0].get("invoice_number"), si2.name)
+		self.assertEqual(len(pr.get("payments")), 2)
+		payment_vouchers = [x.get("reference_name") for x in pr.get("payments")]
+		self.assertCountEqual(payment_vouchers, [je2.name, pe2.name])
+
 
 def make_customer(customer_name, currency=None):
 	if not frappe.db.exists("Customer", customer_name):
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 4fc12db..fc837c7 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -51,7 +51,7 @@
 
 		if existing_payment_request_amount:
 			ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
-			if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") != "Shopping Cart":
+			if not hasattr(ref_doc, "order_type") or getattr(ref_doc, "order_type") != "Shopping Cart":
 				ref_amount = get_amount(ref_doc, self.payment_account)
 
 				if existing_payment_request_amount + flt(self.grand_total) > ref_amount:
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 6281400..54caf6f 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -1426,6 +1426,7 @@
   },
   {
    "default": "0",
+   "depends_on": "apply_tds",
    "fieldname": "tax_withholding_net_total",
    "fieldtype": "Currency",
    "hidden": 1,
@@ -1435,12 +1436,13 @@
    "read_only": 1
   },
   {
+   "depends_on": "apply_tds",
    "fieldname": "base_tax_withholding_net_total",
    "fieldtype": "Currency",
    "hidden": 1,
    "label": "Base Tax Withholding Net Total",
    "no_copy": 1,
-   "options": "currency",
+   "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1
   },
@@ -1554,7 +1556,7 @@
  "idx": 204,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-12-12 18:37:38.142688",
+ "modified": "2023-01-28 19:18:56.586321",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 4729d9c..2f4e45e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1776,6 +1776,8 @@
    "width": "50%"
   },
   {
+   "fetch_from": "sales_partner.commission_rate",
+   "fetch_if_empty": 1,
    "fieldname": "commission_rate",
    "fieldtype": "Float",
    "hide_days": 1,
@@ -2141,7 +2143,7 @@
    "link_fieldname": "consolidated_invoice"
   }
  ],
- "modified": "2022-12-12 18:34:33.409895",
+ "modified": "2023-01-28 19:45:47.538163",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index baeed03..b6eb3ed 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -211,7 +211,13 @@
 	else:
 		party_details.update(get_company_address(company))
 
-	if doctype and doctype in ["Delivery Note", "Sales Invoice", "Sales Order", "Quotation"]:
+	if doctype and doctype in [
+		"Delivery Note",
+		"Sales Invoice",
+		"Sales Order",
+		"Quotation",
+		"POS Invoice",
+	]:
 		if party_details.company_address:
 			party_details.update(
 				get_fetch_values(doctype, "company_address", party_details.company_address)
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index fc23127..27b84c4 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -526,7 +526,7 @@
 			"options": "GL Entry",
 			"hidden": 1,
 		},
-		{"label": _("Posting Date"), "fieldname": "posting_date", "fieldtype": "Date", "width": 90},
+		{"label": _("Posting Date"), "fieldname": "posting_date", "fieldtype": "Date", "width": 100},
 		{
 			"label": _("Account"),
 			"fieldname": "account",
@@ -538,13 +538,13 @@
 			"label": _("Debit ({0})").format(currency),
 			"fieldname": "debit",
 			"fieldtype": "Float",
-			"width": 100,
+			"width": 130,
 		},
 		{
 			"label": _("Credit ({0})").format(currency),
 			"fieldname": "credit",
 			"fieldtype": "Float",
-			"width": 100,
+			"width": 130,
 		},
 		{
 			"label": _("Balance ({0})").format(currency),
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 130b715..25e7891 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -655,10 +655,35 @@
 				return self.calculate_buying_amount_from_sle(
 					row, my_sle, parenttype, parent, item_row, item_code
 				)
+			elif row.sales_order and row.so_detail:
+				incoming_amount = self.get_buying_amount_from_so_dn(row.sales_order, row.so_detail, item_code)
+				if incoming_amount:
+					return incoming_amount
 			else:
 				return flt(row.qty) * self.get_average_buying_rate(row, item_code)
 
-		return 0.0
+		return flt(row.qty) * self.get_average_buying_rate(row, item_code)
+
+	def get_buying_amount_from_so_dn(self, sales_order, so_detail, item_code):
+		from frappe.query_builder.functions import Sum
+
+		delivery_note = frappe.qb.DocType("Delivery Note")
+		delivery_note_item = frappe.qb.DocType("Delivery Note Item")
+
+		query = (
+			frappe.qb.from_(delivery_note)
+			.inner_join(delivery_note_item)
+			.on(delivery_note.name == delivery_note_item.parent)
+			.select(Sum(delivery_note_item.incoming_rate * delivery_note_item.stock_qty))
+			.where(delivery_note.docstatus == 1)
+			.where(delivery_note_item.item_code == item_code)
+			.where(delivery_note_item.against_sales_order == sales_order)
+			.where(delivery_note_item.so_detail == so_detail)
+			.groupby(delivery_note_item.item_code)
+		)
+
+		incoming_amount = query.run()
+		return flt(incoming_amount[0][0]) if incoming_amount else 0
 
 	def get_average_buying_rate(self, row, item_code):
 		args = row
@@ -760,7 +785,8 @@
 				`tabSales Invoice`.territory, `tabSales Invoice Item`.item_code,
 				`tabSales Invoice Item`.item_name, `tabSales Invoice Item`.description,
 				`tabSales Invoice Item`.warehouse, `tabSales Invoice Item`.item_group,
-				`tabSales Invoice Item`.brand, `tabSales Invoice Item`.dn_detail,
+				`tabSales Invoice Item`.brand, `tabSales Invoice Item`.so_detail,
+				`tabSales Invoice Item`.sales_order, `tabSales Invoice Item`.dn_detail,
 				`tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty,
 				`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount,
 				`tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return,
diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py
index fa11a41..21681be 100644
--- a/erpnext/accounts/report/gross_profit/test_gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py
@@ -302,3 +302,82 @@
 
 		columns, data = execute(filters=filters)
 		self.assertGreater(len(data), 0)
+
+	def test_order_connected_dn_and_inv(self):
+		from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+
+		"""
+			Test gp calculation when invoice and delivery note aren't directly connected.
+			SO -- INV
+			|
+			DN
+		"""
+		se = make_stock_entry(
+			company=self.company,
+			item_code=self.item,
+			target=self.warehouse,
+			qty=3,
+			basic_rate=100,
+			do_not_submit=True,
+		)
+		item = se.items[0]
+		se.append(
+			"items",
+			{
+				"item_code": item.item_code,
+				"s_warehouse": item.s_warehouse,
+				"t_warehouse": item.t_warehouse,
+				"qty": 10,
+				"basic_rate": 200,
+				"conversion_factor": item.conversion_factor or 1.0,
+				"transfer_qty": flt(item.qty) * (flt(item.conversion_factor) or 1.0),
+				"serial_no": item.serial_no,
+				"batch_no": item.batch_no,
+				"cost_center": item.cost_center,
+				"expense_account": item.expense_account,
+			},
+		)
+		se = se.save().submit()
+
+		so = make_sales_order(
+			customer=self.customer,
+			company=self.company,
+			warehouse=self.warehouse,
+			item=self.item,
+			qty=4,
+			do_not_save=False,
+			do_not_submit=False,
+		)
+
+		from erpnext.selling.doctype.sales_order.sales_order import (
+			make_delivery_note,
+			make_sales_invoice,
+		)
+
+		make_delivery_note(so.name).submit()
+		sinv = make_sales_invoice(so.name).submit()
+
+		filters = frappe._dict(
+			company=self.company, from_date=nowdate(), to_date=nowdate(), group_by="Invoice"
+		)
+
+		columns, data = execute(filters=filters)
+		expected_entry = {
+			"parent_invoice": sinv.name,
+			"currency": "INR",
+			"sales_invoice": self.item,
+			"customer": self.customer,
+			"posting_date": frappe.utils.datetime.date.fromisoformat(nowdate()),
+			"item_code": self.item,
+			"item_name": self.item,
+			"warehouse": "Stores - _GP",
+			"qty": 4.0,
+			"avg._selling_rate": 100.0,
+			"valuation_rate": 125.0,
+			"selling_amount": 400.0,
+			"buying_amount": 500.0,
+			"gross_profit": -100.0,
+			"gross_profit_%": -25.0,
+		}
+		gp_entry = [x for x in data if x.parent_invoice == sinv.name]
+		self.assertDictContainsSubset(expected_entry, gp_entry[0])
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index 5337fd6..17d4078 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -4,7 +4,17 @@
 
 import frappe
 from frappe import _
-from frappe.utils import add_months, cint, flt, get_link_to_form, getdate, nowdate, today
+from frappe.utils import (
+	add_months,
+	cint,
+	flt,
+	get_last_day,
+	get_link_to_form,
+	getdate,
+	is_last_day_of_the_month,
+	nowdate,
+	today,
+)
 from frappe.utils.user import get_users_with_role
 
 from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@@ -400,6 +410,9 @@
 		row.depreciation_start_date, schedule_idx * cint(row.frequency_of_depreciation)
 	)
 
+	if is_last_day_of_the_month(row.depreciation_start_date):
+		orginal_schedule_date = get_last_day(orginal_schedule_date)
+
 	if orginal_schedule_date == posting_date_of_disposal:
 		return True
 
diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
index faffd11..d41069c 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
@@ -126,16 +126,18 @@
 	if not asset.calculate_depreciation:
 		return flt(asset.gross_purchase_amount) - flt(asset.opening_accumulated_depreciation)
 
-	finance_book_filter = ["finance_book", "is", "not set"]
-	if finance_book:
-		finance_book_filter = ["finance_book", "=", finance_book]
-
-	return frappe.db.get_value(
+	result = frappe.get_all(
 		doctype="Asset Finance Book",
-		filters=[["parent", "=", asset.asset_id], finance_book_filter],
-		fieldname="value_after_depreciation",
+		filters={
+			"parent": asset.asset_id,
+			"finance_book": finance_book or ("is", "not set"),
+		},
+		pluck="value_after_depreciation",
+		limit=1,
 	)
 
+	return result[0] if result else 0.0
+
 
 def prepare_chart_data(data, filters):
 	labels_values_map = {}
diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py
index 646dba5..c673be8 100644
--- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py
+++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py
@@ -15,17 +15,6 @@
 		create_customer()
 		create_item()
 
-	def test_for_single_record(self):
-		so_name = create_so()
-		transaction_processing([{"name": so_name}], "Sales Order", "Sales Invoice")
-		data = frappe.db.get_list(
-			"Sales Invoice",
-			filters={"posting_date": date.today(), "customer": "Bulk Customer"},
-			fields=["*"],
-		)
-		if not data:
-			self.fail("No Sales Invoice Created !")
-
 	def test_entry_in_log(self):
 		so_name = create_so()
 		transaction_processing([{"name": so_name}], "Sales Order", "Sales Invoice")
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index e1dd679..29afc84 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -1221,6 +1221,7 @@
   },
   {
    "default": "0",
+   "depends_on": "apply_tds",
    "fieldname": "tax_withholding_net_total",
    "fieldtype": "Currency",
    "hidden": 1,
@@ -1230,12 +1231,13 @@
    "read_only": 1
   },
   {
+   "depends_on": "apply_tds",
    "fieldname": "base_tax_withholding_net_total",
    "fieldtype": "Currency",
    "hidden": 1,
    "label": "Base Tax Withholding Net Total",
    "no_copy": 1,
-   "options": "currency",
+   "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1
   },
@@ -1269,7 +1271,7 @@
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-12-25 18:08:59.074182",
+ "modified": "2023-01-28 18:59:16.322824",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Purchase Order",
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
index 019d45b..bd65b0c 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
@@ -29,6 +29,7 @@
   "message_for_supplier",
   "terms_section_break",
   "incoterm",
+  "named_place",
   "tc_name",
   "terms",
   "printing_settings",
@@ -278,13 +279,19 @@
    "fieldtype": "Link",
    "label": "Incoterm",
    "options": "Incoterm"
+  },
+  {
+   "depends_on": "incoterm",
+   "fieldname": "named_place",
+   "fieldtype": "Data",
+   "label": "Named Place"
   }
  ],
  "icon": "fa fa-shopping-cart",
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-11-17 17:26:33.770993",
+ "modified": "2023-01-31 23:22:06.684694",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Request for Quotation",
diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
index 47a66ad..9b53421 100644
--- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
+++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
@@ -15,60 +15,4 @@
 
 
 class TestProcurementTracker(FrappeTestCase):
-	def test_result_for_procurement_tracker(self):
-		filters = {"company": "_Test Procurement Company", "cost_center": "Main - _TPC"}
-		expected_data = self.generate_expected_data()
-		report = execute(filters)
-
-		length = len(report[1])
-		self.assertEqual(expected_data, report[1][length - 1])
-
-	def generate_expected_data(self):
-		if not frappe.db.exists("Company", "_Test Procurement Company"):
-			frappe.get_doc(
-				dict(
-					doctype="Company",
-					company_name="_Test Procurement Company",
-					abbr="_TPC",
-					default_currency="INR",
-					country="Pakistan",
-				)
-			).insert()
-		warehouse = create_warehouse("_Test Procurement Warehouse", company="_Test Procurement Company")
-		mr = make_material_request(
-			company="_Test Procurement Company", warehouse=warehouse, cost_center="Main - _TPC"
-		)
-		po = make_purchase_order(mr.name)
-		po.supplier = "_Test Supplier"
-		po.get("items")[0].cost_center = "Main - _TPC"
-		po.submit()
-		pr = make_purchase_receipt(po.name)
-		pr.get("items")[0].cost_center = "Main - _TPC"
-		pr.submit()
-		date_obj = datetime.date(datetime.now())
-
-		po.load_from_db()
-
-		expected_data = {
-			"material_request_date": date_obj,
-			"cost_center": "Main - _TPC",
-			"project": None,
-			"requesting_site": "_Test Procurement Warehouse - _TPC",
-			"requestor": "Administrator",
-			"material_request_no": mr.name,
-			"item_code": "_Test Item",
-			"quantity": 10.0,
-			"unit_of_measurement": "_Test UOM",
-			"status": "To Bill",
-			"purchase_order_date": date_obj,
-			"purchase_order": po.name,
-			"supplier": "_Test Supplier",
-			"estimated_cost": 0.0,
-			"actual_cost": 0.0,
-			"purchase_order_amt": po.net_total,
-			"purchase_order_amt_in_company_currency": po.base_net_total,
-			"expected_delivery_date": date_obj,
-			"actual_delivery_date": date_obj,
-		}
-
-		return expected_data
+	pass
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index b0ff5d4..2a588d8 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -282,6 +282,7 @@
 					"contact_no": "phone_1",
 					"fax": "fax_1",
 				},
+				"field_no_map": ["disabled"],
 			}
 		},
 		target_doc,
@@ -390,7 +391,7 @@
 		{
 			"territory": lead.territory,
 			"customer_name": lead.company_name or lead.lead_name,
-			"contact_display": " ".join(filter(None, [lead.salutation, lead.lead_name])),
+			"contact_display": " ".join(filter(None, [lead.lead_name])),
 			"contact_email": lead.email_id,
 			"contact_mobile": lead.mobile_no,
 			"contact_phone": lead.phone,
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6744d16..698ffac 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -325,3 +325,4 @@
 erpnext.patches.v14_0.create_accounting_dimensions_for_payment_request
 erpnext.patches.v14_0.update_entry_type_for_journal_entry
 erpnext.patches.v14_0.change_autoname_for_tax_withheld_vouchers
+erpnext.patches.v14_0.set_pick_list_status
diff --git a/erpnext/patches/v14_0/migrate_cost_center_allocations.py b/erpnext/patches/v14_0/migrate_cost_center_allocations.py
index 3bd2693..48f4e6d 100644
--- a/erpnext/patches/v14_0/migrate_cost_center_allocations.py
+++ b/erpnext/patches/v14_0/migrate_cost_center_allocations.py
@@ -18,9 +18,11 @@
 		cca = frappe.new_doc("Cost Center Allocation")
 		cca.main_cost_center = main_cc
 		cca.valid_from = today()
+		cca._skip_from_date_validation = True
 
 		for child_cc, percentage in allocations.items():
 			cca.append("allocation_percentages", ({"cost_center": child_cc, "percentage": percentage}))
+
 		cca.save()
 		cca.submit()
 
diff --git a/erpnext/patches/v14_0/set_pick_list_status.py b/erpnext/patches/v14_0/set_pick_list_status.py
new file mode 100644
index 0000000..eea5745
--- /dev/null
+++ b/erpnext/patches/v14_0/set_pick_list_status.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
+# License: MIT. See LICENSE
+
+
+import frappe
+from pypika.terms import ExistsCriterion
+
+
+def execute():
+	pl = frappe.qb.DocType("Pick List")
+	se = frappe.qb.DocType("Stock Entry")
+	dn = frappe.qb.DocType("Delivery Note")
+
+	(
+		frappe.qb.update(pl).set(
+			pl.status,
+			(
+				frappe.qb.terms.Case()
+				.when(pl.docstatus == 0, "Draft")
+				.when(pl.docstatus == 2, "Cancelled")
+				.else_("Completed")
+			),
+		)
+	).run()
+
+	(
+		frappe.qb.update(pl)
+		.set(pl.status, "Open")
+		.where(
+			(
+				ExistsCriterion(
+					frappe.qb.from_(se).select(se.name).where((se.docstatus == 1) & (se.pick_list == pl.name))
+				)
+				| ExistsCriterion(
+					frappe.qb.from_(dn).select(dn.name).where((dn.docstatus == 1) & (dn.pick_list == pl.name))
+				)
+			).negate()
+			& (pl.docstatus == 1)
+		)
+	).run()
diff --git a/erpnext/portal/doctype/homepage_section/test_homepage_section.py b/erpnext/portal/doctype/homepage_section/test_homepage_section.py
index 27c8fe4..3df56e6 100644
--- a/erpnext/portal/doctype/homepage_section/test_homepage_section.py
+++ b/erpnext/portal/doctype/homepage_section/test_homepage_section.py
@@ -10,62 +10,6 @@
 
 
 class TestHomepageSection(unittest.TestCase):
-	def test_homepage_section_card(self):
-		try:
-			frappe.get_doc(
-				{
-					"doctype": "Homepage Section",
-					"name": "Card Section",
-					"section_based_on": "Cards",
-					"section_cards": [
-						{
-							"title": "Card 1",
-							"subtitle": "Subtitle 1",
-							"content": "This is test card 1",
-							"route": "/card-1",
-						},
-						{
-							"title": "Card 2",
-							"subtitle": "Subtitle 2",
-							"content": "This is test card 2",
-							"image": "test.jpg",
-						},
-					],
-					"no_of_columns": 3,
-				}
-			).insert(ignore_if_duplicate=True)
-		except frappe.DuplicateEntryError:
-			pass
-
-		set_request(method="GET", path="home")
-		response = get_response()
-
-		self.assertEqual(response.status_code, 200)
-
-		html = frappe.safe_decode(response.get_data())
-
-		soup = BeautifulSoup(html, "html.parser")
-		sections = soup.find("main").find_all("section")
-		self.assertEqual(len(sections), 3)
-
-		homepage_section = sections[2]
-		self.assertEqual(homepage_section.h3.text, "Card Section")
-
-		cards = homepage_section.find_all(class_="card")
-
-		self.assertEqual(len(cards), 2)
-		self.assertEqual(cards[0].h5.text, "Card 1")
-		self.assertEqual(cards[0].a["href"], "/card-1")
-		self.assertEqual(cards[1].p.text, "Subtitle 2")
-
-		img = cards[1].find(class_="card-img-top")
-
-		self.assertEqual(img["src"], "test.jpg")
-		self.assertEqual(img["loading"], "lazy")
-
-		# cleanup
-		frappe.db.rollback()
-
 	def test_homepage_section_custom_html(self):
 		frappe.get_doc(
 			{
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 3a778fa..09f2c5d 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1691,6 +1691,10 @@
 		var me = this;
 		var valid = true;
 
+		if (frappe.flags.ignore_company_party_validation) {
+			return valid;
+		}
+
 		$.each(["company", "customer"], function(i, fieldname) {
 			if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) &&  !["Purchase Order","Purchase Invoice"].includes(me.frm.doc.doctype)) {
 				if (!me.frm.doc[fieldname]) {
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 9288f51..a913844 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -13,20 +13,12 @@
 
 erpnext.setup.slides_settings = [
 	{
-		// Brand
-		name: 'brand',
-		icon: "fa fa-bookmark",
-		title: __("The Brand"),
-		// help: __('Upload your letter head and logo. (you can edit them later).'),
+		// Organization
+		name: 'organization',
+		title: __("Setup your organization"),
+		icon: "fa fa-building",
 		fields: [
 			{
-				fieldtype: "Attach Image", fieldname: "attach_logo",
-				label: __("Attach Logo"),
-				description: __("100px by 100px"),
-				is_private: 0,
-				align: 'center'
-			},
-			{
 				fieldname: 'company_name',
 				label: __('Company Name'),
 				fieldtype: 'Data',
@@ -35,54 +27,9 @@
 			{
 				fieldname: 'company_abbr',
 				label: __('Company Abbreviation'),
-				fieldtype: 'Data'
-			}
-		],
-		onload: function(slide) {
-			this.bind_events(slide);
-		},
-		bind_events: function (slide) {
-			slide.get_input("company_name").on("change", function () {
-				var parts = slide.get_input("company_name").val().split(" ");
-				var abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
-				slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
-			}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
-
-			slide.get_input("company_abbr").on("change", function () {
-				if (slide.get_input("company_abbr").val().length > 10) {
-					frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
-					slide.get_field("company_abbr").set_value("");
-				}
-			});
-		},
-		validate: function() {
-			if ((this.values.company_name || "").toLowerCase() == "company") {
-				frappe.msgprint(__("Company Name cannot be Company"));
-				return false;
-			}
-			if (!this.values.company_abbr) {
-				return false;
-			}
-			if (this.values.company_abbr.length > 10) {
-				return false;
-			}
-			return true;
-		}
-	},
-	{
-		// Organisation
-		name: 'organisation',
-		title: __("Your Organization"),
-		icon: "fa fa-building",
-		fields: [
-			{
-				fieldname: 'company_tagline',
-				label: __('What does it do?'),
 				fieldtype: 'Data',
-				placeholder: __('e.g. "Build tools for builders"'),
-				reqd: 1
+				hidden: 1
 			},
-			{ fieldname: 'bank_account', label: __('Bank Name'), fieldtype: 'Data', reqd: 1 },
 			{
 				fieldname: 'chart_of_accounts', label: __('Chart of Accounts'),
 				options: "", fieldtype: 'Select'
@@ -94,40 +41,24 @@
 		],
 
 		onload: function (slide) {
-			this.load_chart_of_accounts(slide);
 			this.bind_events(slide);
+			this.load_chart_of_accounts(slide);
 			this.set_fy_dates(slide);
 		},
-
 		validate: function () {
-			let me = this;
-			let exist;
-
 			if (!this.validate_fy_dates()) {
 				return false;
 			}
 
-			// Validate bank name
-			if(me.values.bank_account) {
-				frappe.call({
-					async: false,
-					method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.validate_bank_account",
-					args: {
-						"coa": me.values.chart_of_accounts,
-						"bank_account": me.values.bank_account
-					},
-					callback: function (r) {
-						if(r.message){
-							exist = r.message;
-							me.get_field("bank_account").set_value("");
-							let message = __('Account {0} already exists. Please enter a different name for your bank account.',
-								[me.values.bank_account]
-							);
-							frappe.msgprint(message);
-						}
-					}
-				});
-				return !exist; // Return False if exist = true
+			if ((this.values.company_name || "").toLowerCase() == "company") {
+				frappe.msgprint(__("Company Name cannot be Company"));
+				return false;
+			}
+			if (!this.values.company_abbr) {
+				return false;
+			}
+			if (this.values.company_abbr.length > 10) {
+				return false;
 			}
 
 			return true;
@@ -151,15 +82,15 @@
 			var country = frappe.wizard.values.country;
 
 			if (country) {
-				var fy = erpnext.setup.fiscal_years[country];
-				var current_year = moment(new Date()).year();
-				var next_year = current_year + 1;
+				let fy = erpnext.setup.fiscal_years[country];
+				let current_year = moment(new Date()).year();
+				let next_year = current_year + 1;
 				if (!fy) {
 					fy = ["01-01", "12-31"];
 					next_year = current_year;
 				}
 
-				var year_start_date = current_year + "-" + fy[0];
+				let year_start_date = current_year + "-" + fy[0];
 				if (year_start_date > frappe.datetime.get_today()) {
 					next_year = current_year;
 					current_year -= 1;
@@ -171,7 +102,7 @@
 
 
 		load_chart_of_accounts: function (slide) {
-			var country = frappe.wizard.values.country;
+			let country = frappe.wizard.values.country;
 
 			if (country) {
 				frappe.call({
@@ -202,12 +133,25 @@
 
 				me.charts_modal(slide, chart_template);
 			});
+
+			slide.get_input("company_name").on("change", function () {
+				let parts = slide.get_input("company_name").val().split(" ");
+				let abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
+				slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
+			}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
+
+			slide.get_input("company_abbr").on("change", function () {
+				if (slide.get_input("company_abbr").val().length > 10) {
+					frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
+					slide.get_field("company_abbr").set_value("");
+				}
+			});
 		},
 
 		charts_modal: function(slide, chart_template) {
 			let parent = __('All Accounts');
 
-			var dialog = new frappe.ui.Dialog({
+			let dialog = new frappe.ui.Dialog({
 				title: chart_template,
 				fields: [
 					{'fieldname': 'expand_all', 'label': __('Expand All'), 'fieldtype': 'Button',
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index d37b7bb..51dcd64 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -491,7 +491,20 @@
 	const child_meta = frappe.get_meta(`${frm.doc.doctype} Item`);
 	const get_precision = (fieldname) => child_meta.fields.find(f => f.fieldname == fieldname).precision;
 
-	this.data = [];
+	this.data = frm.doc[opts.child_docname].map((d) => {
+		return {
+			"docname": d.name,
+			"name": d.name,
+			"item_code": d.item_code,
+			"delivery_date": d.delivery_date,
+			"schedule_date": d.schedule_date,
+			"conversion_factor": d.conversion_factor,
+			"qty": d.qty,
+			"rate": d.rate,
+			"uom": d.uom
+		}
+	});
+
 	const fields = [{
 		fieldtype:'Data',
 		fieldname:"docname",
@@ -588,7 +601,7 @@
 		})
 	}
 
-	const dialog = new frappe.ui.Dialog({
+	new frappe.ui.Dialog({
 		title: __("Update Items"),
 		fields: [
 			{
@@ -624,24 +637,7 @@
 			refresh_field("items");
 		},
 		primary_action_label: __('Update')
-	});
-
-	frm.doc[opts.child_docname].forEach(d => {
-		dialog.fields_dict.trans_items.df.data.push({
-			"docname": d.name,
-			"name": d.name,
-			"item_code": d.item_code,
-			"delivery_date": d.delivery_date,
-			"schedule_date": d.schedule_date,
-			"conversion_factor": d.conversion_factor,
-			"qty": d.qty,
-			"rate": d.rate,
-			"uom": d.uom
-		});
-		this.data = dialog.fields_dict.trans_items.df.data;
-		dialog.fields_dict.trans_items.grid.refresh();
-	})
-	dialog.show();
+	}).show();
 }
 
 erpnext.utils.map_current_doc = function(opts) {
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 999ddc2..158ac1d 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -17,45 +17,79 @@
 def search_by_term(search_term, warehouse, price_list):
 	result = search_for_serial_or_batch_or_barcode_number(search_term) or {}
 
-	item_code = result.get("item_code") or search_term
-	serial_no = result.get("serial_no") or ""
-	batch_no = result.get("batch_no") or ""
-	barcode = result.get("barcode") or ""
+	item_code = result.get("item_code", search_term)
+	serial_no = result.get("serial_no", "")
+	batch_no = result.get("batch_no", "")
+	barcode = result.get("barcode", "")
 
-	if result:
-		item_info = frappe.db.get_value(
-			"Item",
-			item_code,
-			[
-				"name as item_code",
-				"item_name",
-				"description",
-				"stock_uom",
-				"image as item_image",
-				"is_stock_item",
-			],
-			as_dict=1,
-		)
+	if not result:
+		return
 
-		item_stock_qty, is_stock_item = get_stock_availability(item_code, warehouse)
-		price_list_rate, currency = frappe.db.get_value(
-			"Item Price",
-			{"price_list": price_list, "item_code": item_code},
-			["price_list_rate", "currency"],
-		) or [None, None]
+	item_doc = frappe.get_doc("Item", item_code)
 
-		item_info.update(
+	if not item_doc:
+		return
+
+	item = {
+		"barcode": barcode,
+		"batch_no": batch_no,
+		"description": item_doc.description,
+		"is_stock_item": item_doc.is_stock_item,
+		"item_code": item_doc.name,
+		"item_image": item_doc.image,
+		"item_name": item_doc.item_name,
+		"serial_no": serial_no,
+		"stock_uom": item_doc.stock_uom,
+		"uom": item_doc.stock_uom,
+	}
+
+	if barcode:
+		barcode_info = next(filter(lambda x: x.barcode == barcode, item_doc.get("barcodes", [])), None)
+		if barcode_info and barcode_info.uom:
+			uom = next(filter(lambda x: x.uom == barcode_info.uom, item_doc.uoms), {})
+			item.update(
+				{
+					"uom": barcode_info.uom,
+					"conversion_factor": uom.get("conversion_factor", 1),
+				}
+			)
+
+	item_stock_qty, is_stock_item = get_stock_availability(item_code, warehouse)
+	item_stock_qty = item_stock_qty // item.get("conversion_factor")
+	item.update({"actual_qty": item_stock_qty})
+
+	price = frappe.get_list(
+		doctype="Item Price",
+		filters={
+			"price_list": price_list,
+			"item_code": item_code,
+		},
+		fields=["uom", "stock_uom", "currency", "price_list_rate"],
+	)
+
+	def __sort(p):
+		p_uom = p.get("uom")
+
+		if p_uom == item.get("uom"):
+			return 0
+		elif p_uom == item.get("stock_uom"):
+			return 1
+		else:
+			return 2
+
+	# sort by fallback preference. always pick exact uom match if available
+	price = sorted(price, key=__sort)
+
+	if len(price) > 0:
+		p = price.pop(0)
+		item.update(
 			{
-				"serial_no": serial_no,
-				"batch_no": batch_no,
-				"barcode": barcode,
-				"price_list_rate": price_list_rate,
-				"currency": currency,
-				"actual_qty": item_stock_qty,
+				"currency": p.get("currency"),
+				"price_list_rate": p.get("price_list_rate"),
 			}
 		)
 
-		return {"items": [item_info]}
+	return {"items": [item]}
 
 
 @frappe.whitelist()
@@ -121,33 +155,43 @@
 		as_dict=1,
 	)
 
-	if items_data:
-		items = [d.item_code for d in items_data]
-		item_prices_data = frappe.get_all(
+	# return (empty) list if there are no results
+	if not items_data:
+		return result
+
+	for item in items_data:
+		uoms = frappe.get_doc("Item", item.item_code).get("uoms", [])
+
+		item.actual_qty, _ = get_stock_availability(item.item_code, warehouse)
+		item.uom = item.stock_uom
+
+		item_price = frappe.get_all(
 			"Item Price",
-			fields=["item_code", "price_list_rate", "currency"],
-			filters={"price_list": price_list, "item_code": ["in", items]},
+			fields=["price_list_rate", "currency", "uom"],
+			filters={
+				"price_list": price_list,
+				"item_code": item.item_code,
+				"selling": True,
+			},
 		)
 
-		item_prices = {}
-		for d in item_prices_data:
-			item_prices[d.item_code] = d
+		if not item_price:
+			result.append(item)
 
-		for item in items_data:
-			item_code = item.item_code
-			item_price = item_prices.get(item_code) or {}
-			item_stock_qty, is_stock_item = get_stock_availability(item_code, warehouse)
+		for price in item_price:
+			uom = next(filter(lambda x: x.uom == price.uom, uoms), {})
 
-			row = {}
-			row.update(item)
-			row.update(
+			if price.uom != item.stock_uom and uom and uom.conversion_factor:
+				item.actual_qty = item.actual_qty // uom.conversion_factor
+
+			result.append(
 				{
-					"price_list_rate": item_price.get("price_list_rate"),
-					"currency": item_price.get("currency"),
-					"actual_qty": item_stock_qty,
+					**item,
+					"price_list_rate": price.get("price_list_rate"),
+					"currency": price.get("currency"),
+					"uom": price.uom or item.uom,
 				}
 			)
-			result.append(row)
 
 	return {"items": result}
 
diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js
index 595b919..c442774 100644
--- a/erpnext/selling/page/point_of_sale/pos_controller.js
+++ b/erpnext/selling/page/point_of_sale/pos_controller.js
@@ -542,12 +542,12 @@
 				if (!this.frm.doc.customer)
 					return this.raise_customer_selection_alert();
 
-				const { item_code, batch_no, serial_no, rate } = item;
+				const { item_code, batch_no, serial_no, rate, uom } = item;
 
 				if (!item_code)
 					return;
 
-				const new_item = { item_code, batch_no, rate, [field]: value };
+				const new_item = { item_code, batch_no, rate, uom, [field]: value };
 
 				if (serial_no) {
 					await this.check_serial_no_availablilty(item_code, this.frm.doc.set_warehouse, serial_no);
@@ -649,6 +649,7 @@
 		const is_stock_item = resp[1];
 
 		frappe.dom.unfreeze();
+		const bold_uom = item_row.stock_uom.bold();
 		const bold_item_code = item_row.item_code.bold();
 		const bold_warehouse = warehouse.bold();
 		const bold_available_qty = available_qty.toString().bold()
@@ -664,7 +665,7 @@
 			}
 		} else if (is_stock_item && available_qty < qty_needed) {
 			frappe.throw({
-				message: __('Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2}.', [bold_item_code, bold_warehouse, bold_available_qty]),
+				message: __('Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2} {3}.', [bold_item_code, bold_warehouse, bold_available_qty, bold_uom]),
 				indicator: 'orange'
 			});
 			frappe.utils.play_sound("error");
diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js
index e7dd211..12cc629 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_cart.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js
@@ -609,7 +609,7 @@
 			if (item_data.rate && item_data.amount && item_data.rate !== item_data.amount) {
 				return `
 					<div class="item-qty-rate">
-						<div class="item-qty"><span>${item_data.qty || 0}</span></div>
+						<div class="item-qty"><span>${item_data.qty || 0} ${item_data.uom}</span></div>
 						<div class="item-rate-amount">
 							<div class="item-rate">${format_currency(item_data.amount, currency)}</div>
 							<div class="item-amount">${format_currency(item_data.rate, currency)}</div>
@@ -618,7 +618,7 @@
 			} else {
 				return `
 					<div class="item-qty-rate">
-						<div class="item-qty"><span>${item_data.qty || 0}</span></div>
+						<div class="item-qty"><span>${item_data.qty || 0} ${item_data.uom}</span></div>
 						<div class="item-rate-amount">
 							<div class="item-rate">${format_currency(item_data.rate, currency)}</div>
 						</div>
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 b5eb048..ec67bdf 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_selector.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js
@@ -78,7 +78,7 @@
 	get_item_html(item) {
 		const me = this;
 		// eslint-disable-next-line no-unused-vars
-		const { item_image, serial_no, batch_no, barcode, actual_qty, stock_uom, price_list_rate } = item;
+		const { item_image, serial_no, batch_no, barcode, actual_qty, uom, price_list_rate } = item;
 		const precision = flt(price_list_rate, 2) % 1 != 0 ? 2 : 0;
 		let indicator_color;
 		let qty_to_display = actual_qty;
@@ -118,7 +118,7 @@
 		return (
 			`<div class="item-wrapper"
 				data-item-code="${escape(item.item_code)}" data-serial-no="${escape(serial_no)}"
-				data-batch-no="${escape(batch_no)}" data-uom="${escape(stock_uom)}"
+				data-batch-no="${escape(batch_no)}" data-uom="${escape(uom)}"
 				data-rate="${escape(price_list_rate || 0)}"
 				title="${item.item_name}">
 
@@ -128,7 +128,7 @@
 					<div class="item-name">
 						${frappe.ellipsis(item.item_name, 18)}
 					</div>
-					<div class="item-rate">${format_currency(price_list_rate, item.currency, precision) || 0}</div>
+					<div class="item-rate">${format_currency(price_list_rate, item.currency, precision) || 0} / ${uom}</div>
 				</div>
 			</div>`
 		);
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
index 40165c3..be75bd6 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
@@ -94,7 +94,7 @@
 	get_item_html(doc, item_data) {
 		return `<div class="item-row-wrapper">
 					<div class="item-name">${item_data.item_name}</div>
-					<div class="item-qty">${item_data.qty || 0}</div>
+					<div class="item-qty">${item_data.qty || 0} ${item_data.uom}</div>
 					<div class="item-rate-disc">${get_rate_discount_html()}</div>
 				</div>`;
 
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index aadc989..ace5cca 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -4,7 +4,6 @@
 import frappe
 from frappe import _
 from frappe.utils import cstr, getdate
-from .default_website import website_maker
 
 
 def create_fiscal_year_and_company(args):
@@ -48,83 +47,6 @@
 	).insert()
 
 
-def create_email_digest():
-	from frappe.utils.user import get_system_managers
-
-	system_managers = get_system_managers(only_name=True)
-
-	if not system_managers:
-		return
-
-	recipients = []
-	for d in system_managers:
-		recipients.append({"recipient": d})
-
-	companies = frappe.db.sql_list("select name FROM `tabCompany`")
-	for company in companies:
-		if not frappe.db.exists("Email Digest", "Default Weekly Digest - " + company):
-			edigest = frappe.get_doc(
-				{
-					"doctype": "Email Digest",
-					"name": "Default Weekly Digest - " + company,
-					"company": company,
-					"frequency": "Weekly",
-					"recipients": recipients,
-				}
-			)
-
-			for df in edigest.meta.get("fields", {"fieldtype": "Check"}):
-				if df.fieldname != "scheduler_errors":
-					edigest.set(df.fieldname, 1)
-
-			edigest.insert()
-
-	# scheduler errors digest
-	if companies:
-		edigest = frappe.new_doc("Email Digest")
-		edigest.update(
-			{
-				"name": "Scheduler Errors",
-				"company": companies[0],
-				"frequency": "Daily",
-				"recipients": recipients,
-				"scheduler_errors": 1,
-				"enabled": 1,
-			}
-		)
-		edigest.insert()
-
-
-def create_logo(args):
-	if args.get("attach_logo"):
-		attach_logo = args.get("attach_logo").split(",")
-		if len(attach_logo) == 3:
-			filename, filetype, content = attach_logo
-			_file = frappe.get_doc(
-				{
-					"doctype": "File",
-					"file_name": filename,
-					"attached_to_doctype": "Website Settings",
-					"attached_to_name": "Website Settings",
-					"decode": True,
-				}
-			)
-			_file.save()
-			fileurl = _file.file_url
-			frappe.db.set_value(
-				"Website Settings",
-				"Website Settings",
-				"brand_html",
-				"<img src='{0}' style='max-width: 40px; max-height: 25px;'> {1}".format(
-					fileurl, args.get("company_name")
-				),
-			)
-
-
-def create_website(args):
-	website_maker(args)
-
-
 def get_fy_details(fy_start_date, fy_end_date):
 	start_year = getdate(fy_start_date).year
 	if start_year == getdate(fy_end_date).year:
diff --git a/erpnext/setup/setup_wizard/operations/default_website.py b/erpnext/setup/setup_wizard/operations/default_website.py
deleted file mode 100644
index 40b02b3..0000000
--- a/erpnext/setup/setup_wizard/operations/default_website.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-
-import frappe
-from frappe import _
-from frappe.utils import nowdate
-
-
-class website_maker(object):
-	def __init__(self, args):
-		self.args = args
-		self.company = args.company_name
-		self.tagline = args.company_tagline
-		self.user = args.get("email")
-		self.make_web_page()
-		self.make_website_settings()
-		self.make_blog()
-
-	def make_web_page(self):
-		# home page
-		homepage = frappe.get_doc("Homepage", "Homepage")
-		homepage.company = self.company
-		homepage.tag_line = self.tagline
-		homepage.setup_items()
-		homepage.save()
-
-	def make_website_settings(self):
-		# update in home page in settings
-		website_settings = frappe.get_doc("Website Settings", "Website Settings")
-		website_settings.home_page = "home"
-		website_settings.brand_html = self.company
-		website_settings.copyright = self.company
-		website_settings.top_bar_items = []
-		website_settings.append(
-			"top_bar_items", {"doctype": "Top Bar Item", "label": "Contact", "url": "/contact"}
-		)
-		website_settings.append(
-			"top_bar_items", {"doctype": "Top Bar Item", "label": "Blog", "url": "/blog"}
-		)
-		website_settings.append(
-			"top_bar_items", {"doctype": "Top Bar Item", "label": _("Products"), "url": "/all-products"}
-		)
-		website_settings.save()
-
-	def make_blog(self):
-		blog_category = frappe.get_doc(
-			{"doctype": "Blog Category", "category_name": "general", "published": 1, "title": _("General")}
-		).insert()
-
-		if not self.user:
-			# Admin setup
-			return
-
-		blogger = frappe.new_doc("Blogger")
-		user = frappe.get_doc("User", self.user)
-		blogger.user = self.user
-		blogger.full_name = user.first_name + (" " + user.last_name if user.last_name else "")
-		blogger.short_name = user.first_name.lower()
-		blogger.avatar = user.user_image
-		blogger.insert()
-
-		frappe.get_doc(
-			{
-				"doctype": "Blog Post",
-				"title": "Welcome",
-				"published": 1,
-				"published_on": nowdate(),
-				"blogger": blogger.name,
-				"blog_category": blog_category.name,
-				"blog_intro": "My First Blog",
-				"content": frappe.get_template("setup/setup_wizard/data/sample_blog_post.html").render(),
-			}
-		).insert()
-
-
-def test():
-	frappe.delete_doc("Web Page", "test-company")
-	frappe.delete_doc("Blog Post", "welcome")
-	frappe.delete_doc("Blogger", "administrator")
-	frappe.delete_doc("Blog Category", "general")
-	website_maker(
-		{
-			"company": "Test Company",
-			"company_tagline": "Better Tools for Everyone",
-			"name": "Administrator",
-		}
-	)
-	frappe.db.commit()
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index bd86a5b..65b268e 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -5,7 +5,6 @@
 import frappe
 from frappe import _
 
-from .operations import company_setup
 from .operations import install_fixtures as fixtures
 
 
@@ -35,7 +34,6 @@
 				"fail_msg": "Failed to set defaults",
 				"tasks": [
 					{"fn": setup_defaults, "args": args, "fail_msg": _("Failed to setup defaults")},
-					{"fn": stage_four, "args": args, "fail_msg": _("Failed to create website")},
 				],
 			},
 			{
@@ -60,12 +58,6 @@
 	fixtures.install_defaults(frappe._dict(args))
 
 
-def stage_four(args):
-	company_setup.create_website(args)
-	company_setup.create_email_digest()
-	company_setup.create_logo(args)
-
-
 def fin(args):
 	frappe.local.message_log = []
 	login_as_first_user(args)
@@ -81,5 +73,4 @@
 	stage_fixtures(args)
 	setup_company(args)
 	setup_defaults(args)
-	stage_four(args)
 	fin(args)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index a1df764..9f9f5cb 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -228,6 +228,7 @@
 
 	def on_submit(self):
 		self.validate_packed_qty()
+		self.update_pick_list_status()
 
 		# Check for Approving Authority
 		frappe.get_doc("Authorization Control").validate_approving_authority(
@@ -313,6 +314,11 @@
 		if has_error:
 			raise frappe.ValidationError
 
+	def update_pick_list_status(self):
+		from erpnext.stock.doctype.pick_list.pick_list import update_pick_list_status
+
+		update_pick_list_status(self.pick_list)
+
 	def check_next_docstatus(self):
 		submit_rv = frappe.db.sql(
 			"""select t1.name
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
index ba1023a..0310682 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
@@ -37,7 +37,7 @@
 		if (frm.doc.__onload && frm.doc.__onload.has_stock_ledger
 			&& frm.doc.__onload.has_stock_ledger.length) {
 			let allow_to_edit_fields = ['disabled', 'fetch_from_parent',
-				'type_of_transaction', 'condition'];
+				'type_of_transaction', 'condition', 'mandatory_depends_on'];
 
 			frm.fields.forEach((field) => {
 				if (!in_list(allow_to_edit_fields, field.df.fieldname)) {
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
index 4397e11..eb6102a 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
@@ -24,6 +24,9 @@
   "istable",
   "applicable_condition_example_section",
   "condition",
+  "conditional_mandatory_section",
+  "reqd",
+  "mandatory_depends_on",
   "conditional_rule_examples_section",
   "html_19"
  ],
@@ -153,11 +156,28 @@
    "fieldname": "conditional_rule_examples_section",
    "fieldtype": "Section Break",
    "label": "Conditional Rule Examples"
+  },
+  {
+   "description": "To apply condition on parent field use parent.field_name and to apply condition on child table use doc.field_name. Here field_name could be based on the actual column name of the respective field.",
+   "fieldname": "mandatory_depends_on",
+   "fieldtype": "Small Text",
+   "label": "Mandatory Depends On"
+  },
+  {
+   "fieldname": "conditional_mandatory_section",
+   "fieldtype": "Section Break",
+   "label": "Mandatory Section"
+  },
+  {
+   "default": "0",
+   "fieldname": "reqd",
+   "fieldtype": "Check",
+   "label": "Mandatory"
   }
  ],
  "index_web_pages_for_search": 1,
  "links": [],
- "modified": "2022-11-15 15:50:16.767105",
+ "modified": "2023-01-31 13:44:38.507698",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Inventory Dimension",
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
index 009548a..db2b5d0 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
@@ -126,6 +126,8 @@
 				insert_after="inventory_dimension",
 				options=self.reference_document,
 				label=self.dimension_name,
+				reqd=self.reqd,
+				mandatory_depends_on=self.mandatory_depends_on,
 			),
 		]
 
@@ -142,6 +144,8 @@
 			"Custom Field", {"dt": "Stock Ledger Entry", "fieldname": self.target_fieldname}
 		) and not field_exists("Stock Ledger Entry", self.target_fieldname):
 			dimension_field = dimension_fields[1]
+			dimension_field["mandatory_depends_on"] = ""
+			dimension_field["reqd"] = 0
 			dimension_field["fieldname"] = self.target_fieldname
 			custom_fields["Stock Ledger Entry"] = dimension_field
 
diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
index edff3fd..28b1ed9 100644
--- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
+++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
@@ -85,6 +85,9 @@
 			condition="parent.purpose == 'Material Issue'",
 		)
 
+		inv_dim1.reqd = 0
+		inv_dim1.save()
+
 		create_inventory_dimension(
 			reference_document="Shelf",
 			type_of_transaction="Inward",
@@ -205,6 +208,48 @@
 			)
 		)
 
+	def test_check_mandatory_dimensions(self):
+		doc = create_inventory_dimension(
+			reference_document="Pallet",
+			type_of_transaction="Outward",
+			dimension_name="Pallet",
+			apply_to_all_doctypes=0,
+			document_type="Stock Entry Detail",
+		)
+
+		doc.reqd = 1
+		doc.save()
+
+		self.assertTrue(
+			frappe.db.get_value(
+				"Custom Field", {"fieldname": "pallet", "dt": "Stock Entry Detail", "reqd": 1}, "name"
+			)
+		)
+
+		doc.load_from_db
+		doc.reqd = 0
+		doc.save()
+
+	def test_check_mandatory_depends_on_dimensions(self):
+		doc = create_inventory_dimension(
+			reference_document="Pallet",
+			type_of_transaction="Outward",
+			dimension_name="Pallet",
+			apply_to_all_doctypes=0,
+			document_type="Stock Entry Detail",
+		)
+
+		doc.mandatory_depends_on = "t_warehouse"
+		doc.save()
+
+		self.assertTrue(
+			frappe.db.get_value(
+				"Custom Field",
+				{"fieldname": "pallet", "dt": "Stock Entry Detail", "mandatory_depends_on": "t_warehouse"},
+				"name",
+			)
+		)
+
 
 def prepare_test_data():
 	if not frappe.db.exists("DocType", "Shelf"):
@@ -251,6 +296,22 @@
 
 	create_warehouse("Rack Warehouse")
 
+	if not frappe.db.exists("DocType", "Pallet"):
+		frappe.get_doc(
+			{
+				"doctype": "DocType",
+				"name": "Pallet",
+				"module": "Stock",
+				"custom": 1,
+				"naming_rule": "By fieldname",
+				"autoname": "field:pallet_name",
+				"fields": [{"label": "Pallet Name", "fieldname": "pallet_name", "fieldtype": "Data"}],
+				"permissions": [
+					{"role": "System Manager", "permlevel": 0, "read": 1, "write": 1, "create": 1, "delete": 1}
+				],
+			}
+		).insert(ignore_permissions=True)
+
 
 def create_inventory_dimension(**args):
 	args = frappe._dict(args)
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index e61f0f5..5bcb05a 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -894,6 +894,12 @@
 		new_child_doc.uom = frm.doc.stock_uom;
 		new_child_doc.description = frm.doc.description;
 
-		frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
+		frappe.run_serially([
+			() => frappe.ui.form.make_quick_entry(doctype, null, null, new_doc),
+			() => {
+				frappe.flags.ignore_company_party_validation = true;
+				frappe.model.trigger("item_code", frm.doc.name, new_child_doc);
+			}
+		])
 	});
 }
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 5f05de6..156e591 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -366,10 +366,11 @@
 
 frappe.ui.form.on("Material Request Item", {
 	qty: function (frm, doctype, name) {
-		var d = locals[doctype][name];
-		if (flt(d.qty) < flt(d.min_order_qty)) {
+		const item = locals[doctype][name];
+		if (flt(item.qty) < flt(item.min_order_qty)) {
 			frappe.msgprint(__("Warning: Material Requested Qty is less than Minimum Order Qty"));
 		}
+		frm.events.get_item_data(frm, item, false);
 	},
 
 	from_warehouse: function(frm, doctype, name) {
diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json
index e1c3f0f..7259dc0 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.json
+++ b/erpnext/stock/doctype/pick_list/pick_list.json
@@ -26,7 +26,8 @@
   "locations",
   "amended_from",
   "print_settings_section",
-  "group_same_items"
+  "group_same_items",
+  "status"
  ],
  "fields": [
   {
@@ -168,11 +169,26 @@
    "fieldtype": "Data",
    "label": "Customer Name",
    "read_only": 1
+  },
+  {
+   "default": "Draft",
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "hidden": 1,
+   "in_standard_filter": 1,
+   "label": "Status",
+   "no_copy": 1,
+   "options": "Draft\nOpen\nCompleted\nCancelled",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 1,
+   "reqd": 1,
+   "search_index": 1
   }
  ],
  "is_submittable": 1,
  "links": [],
- "modified": "2022-07-19 11:03:04.442174",
+ "modified": "2023-01-24 10:33:43.244476",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Pick List",
@@ -244,4 +260,4 @@
  "sort_order": "DESC",
  "states": [],
  "track_changes": 1
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 808f19e..bf3b5dd 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -11,7 +11,8 @@
 from frappe.model.document import Document
 from frappe.model.mapper import map_child_doc
 from frappe.query_builder import Case
-from frappe.query_builder.functions import IfNull, Locate, Sum
+from frappe.query_builder.custom import GROUP_CONCAT
+from frappe.query_builder.functions import Coalesce, IfNull, Locate, Replace, Sum
 from frappe.utils import cint, floor, flt, today
 from frappe.utils.nestedset import get_descendants_of
 
@@ -77,15 +78,32 @@
 				)
 
 	def on_submit(self):
+		self.update_status()
 		self.update_bundle_picked_qty()
 		self.update_reference_qty()
 		self.update_sales_order_picking_status()
 
 	def on_cancel(self):
+		self.update_status()
 		self.update_bundle_picked_qty()
 		self.update_reference_qty()
 		self.update_sales_order_picking_status()
 
+	def update_status(self, status=None, update_modified=True):
+		if not status:
+			if self.docstatus == 0:
+				status = "Draft"
+			elif self.docstatus == 1:
+				if self.status == "Draft":
+					status = "Open"
+				elif target_document_exists(self.name, self.purpose):
+					status = "Completed"
+			elif self.docstatus == 2:
+				status = "Cancelled"
+
+		if status:
+			frappe.db.set_value("Pick List", self.name, "status", status, update_modified=update_modified)
+
 	def update_reference_qty(self):
 		packed_items = []
 		so_items = []
@@ -162,6 +180,7 @@
 	def set_item_locations(self, save=False):
 		self.validate_for_qty()
 		items = self.aggregate_item_qty()
+		picked_items_details = self.get_picked_items_details(items)
 		self.item_location_map = frappe._dict()
 
 		from_warehouses = None
@@ -180,7 +199,11 @@
 			self.item_location_map.setdefault(
 				item_code,
 				get_available_item_locations(
-					item_code, from_warehouses, self.item_count_map.get(item_code), self.company
+					item_code,
+					from_warehouses,
+					self.item_count_map.get(item_code),
+					self.company,
+					picked_item_details=picked_items_details.get(item_code),
 				),
 			)
 
@@ -309,6 +332,56 @@
 				already_picked + (picked_qty * (1 if self.docstatus == 1 else -1)),
 			)
 
+	def get_picked_items_details(self, items):
+		picked_items = frappe._dict()
+
+		if items:
+			pi = frappe.qb.DocType("Pick List")
+			pi_item = frappe.qb.DocType("Pick List Item")
+			query = (
+				frappe.qb.from_(pi)
+				.inner_join(pi_item)
+				.on(pi.name == pi_item.parent)
+				.select(
+					pi_item.item_code,
+					pi_item.warehouse,
+					pi_item.batch_no,
+					Sum(Case().when(pi_item.picked_qty > 0, pi_item.picked_qty).else_(pi_item.stock_qty)).as_(
+						"picked_qty"
+					),
+					Replace(GROUP_CONCAT(pi_item.serial_no), ",", "\n").as_("serial_no"),
+				)
+				.where(
+					(pi_item.item_code.isin([x.item_code for x in items]))
+					& ((pi_item.picked_qty > 0) | (pi_item.stock_qty > 0))
+					& (pi.status != "Completed")
+					& (pi_item.docstatus != 2)
+				)
+				.groupby(
+					pi_item.item_code,
+					pi_item.warehouse,
+					pi_item.batch_no,
+				)
+			)
+
+			if self.name:
+				query = query.where(pi_item.parent != self.name)
+
+			items_data = query.run(as_dict=True)
+
+			for item_data in items_data:
+				key = (item_data.warehouse, item_data.batch_no) if item_data.batch_no else item_data.warehouse
+				serial_no = [x for x in item_data.serial_no.split("\n") if x] if item_data.serial_no else None
+				data = {"picked_qty": item_data.picked_qty}
+				if serial_no:
+					data["serial_no"] = serial_no
+				if item_data.item_code not in picked_items:
+					picked_items[item_data.item_code] = {key: data}
+				else:
+					picked_items[item_data.item_code][key] = data
+
+		return picked_items
+
 	def _get_product_bundles(self) -> Dict[str, str]:
 		# Dict[so_item_row: item_code]
 		product_bundles = {}
@@ -346,29 +419,30 @@
 		return int(flt(min(possible_bundles), precision or 6))
 
 
+def update_pick_list_status(pick_list):
+	if pick_list:
+		doc = frappe.get_doc("Pick List", pick_list)
+		doc.run_method("update_status")
+
+
 def get_picked_items_qty(items) -> List[Dict]:
-	return frappe.db.sql(
-		f"""
-		SELECT
-			sales_order_item,
-			item_code,
-			sales_order,
-			SUM(stock_qty) AS stock_qty,
-			SUM(picked_qty) AS picked_qty
-		FROM
-			`tabPick List Item`
-		WHERE
-			sales_order_item IN (
-				{", ".join(frappe.db.escape(d) for d in items)}
-			)
-			AND docstatus = 1
-		GROUP BY
-			sales_order_item,
-			sales_order
-		FOR UPDATE
-	""",
-		as_dict=1,
-	)
+	pi_item = frappe.qb.DocType("Pick List Item")
+	return (
+		frappe.qb.from_(pi_item)
+		.select(
+			pi_item.sales_order_item,
+			pi_item.item_code,
+			pi_item.sales_order,
+			Sum(pi_item.stock_qty).as_("stock_qty"),
+			Sum(pi_item.picked_qty).as_("picked_qty"),
+		)
+		.where((pi_item.docstatus == 1) & (pi_item.sales_order_item.isin(items)))
+		.groupby(
+			pi_item.sales_order_item,
+			pi_item.sales_order,
+		)
+		.for_update()
+	).run(as_dict=True)
 
 
 def validate_item_locations(pick_list):
@@ -434,31 +508,38 @@
 
 
 def get_available_item_locations(
-	item_code, from_warehouses, required_qty, company, ignore_validation=False
+	item_code,
+	from_warehouses,
+	required_qty,
+	company,
+	ignore_validation=False,
+	picked_item_details=None,
 ):
 	locations = []
+	total_picked_qty = (
+		sum([v.get("picked_qty") for k, v in picked_item_details.items()]) if picked_item_details else 0
+	)
 	has_serial_no = frappe.get_cached_value("Item", item_code, "has_serial_no")
 	has_batch_no = frappe.get_cached_value("Item", item_code, "has_batch_no")
 
 	if has_batch_no and has_serial_no:
 		locations = get_available_item_locations_for_serial_and_batched_item(
-			item_code, from_warehouses, required_qty, company
+			item_code, from_warehouses, required_qty, company, total_picked_qty
 		)
 	elif has_serial_no:
 		locations = get_available_item_locations_for_serialized_item(
-			item_code, from_warehouses, required_qty, company
+			item_code, from_warehouses, required_qty, company, total_picked_qty
 		)
 	elif has_batch_no:
 		locations = get_available_item_locations_for_batched_item(
-			item_code, from_warehouses, required_qty, company
+			item_code, from_warehouses, required_qty, company, total_picked_qty
 		)
 	else:
 		locations = get_available_item_locations_for_other_item(
-			item_code, from_warehouses, required_qty, company
+			item_code, from_warehouses, required_qty, company, total_picked_qty
 		)
 
 	total_qty_available = sum(location.get("qty") for location in locations)
-
 	remaining_qty = required_qty - total_qty_available
 
 	if remaining_qty > 0 and not ignore_validation:
@@ -469,25 +550,60 @@
 			title=_("Insufficient Stock"),
 		)
 
+	if picked_item_details:
+		for location in list(locations):
+			key = (
+				(location["warehouse"], location["batch_no"])
+				if location.get("batch_no")
+				else location["warehouse"]
+			)
+
+			if key in picked_item_details:
+				picked_detail = picked_item_details[key]
+
+				if picked_detail.get("serial_no") and location.get("serial_no"):
+					location["serial_no"] = list(
+						set(location["serial_no"]).difference(set(picked_detail["serial_no"]))
+					)
+					location["qty"] = len(location["serial_no"])
+				else:
+					location["qty"] -= picked_detail.get("picked_qty")
+
+			if location["qty"] < 1:
+				locations.remove(location)
+
+		total_qty_available = sum(location.get("qty") for location in locations)
+		remaining_qty = required_qty - total_qty_available
+
+		if remaining_qty > 0 and not ignore_validation:
+			frappe.msgprint(
+				_("{0} units of Item {1} is picked in another Pick List.").format(
+					remaining_qty, frappe.get_desk_link("Item", item_code)
+				),
+				title=_("Already Picked"),
+			)
+
 	return locations
 
 
 def get_available_item_locations_for_serialized_item(
-	item_code, from_warehouses, required_qty, company
+	item_code, from_warehouses, required_qty, company, total_picked_qty=0
 ):
-	filters = frappe._dict({"item_code": item_code, "company": company, "warehouse": ["!=", ""]})
+	sn = frappe.qb.DocType("Serial No")
+	query = (
+		frappe.qb.from_(sn)
+		.select(sn.name, sn.warehouse)
+		.where((sn.item_code == item_code) & (sn.company == company))
+		.orderby(sn.purchase_date)
+		.limit(cint(required_qty + total_picked_qty))
+	)
 
 	if from_warehouses:
-		filters.warehouse = ["in", from_warehouses]
+		query = query.where(sn.warehouse.isin(from_warehouses))
+	else:
+		query = query.where(Coalesce(sn.warehouse, "") != "")
 
-	serial_nos = frappe.get_all(
-		"Serial No",
-		fields=["name", "warehouse"],
-		filters=filters,
-		limit=required_qty,
-		order_by="purchase_date",
-		as_list=1,
-	)
+	serial_nos = query.run(as_list=True)
 
 	warehouse_serial_nos_map = frappe._dict()
 	for serial_no, warehouse in serial_nos:
@@ -501,7 +617,7 @@
 
 
 def get_available_item_locations_for_batched_item(
-	item_code, from_warehouses, required_qty, company
+	item_code, from_warehouses, required_qty, company, total_picked_qty=0
 ):
 	sle = frappe.qb.DocType("Stock Ledger Entry")
 	batch = frappe.qb.DocType("Batch")
@@ -521,6 +637,7 @@
 		.groupby(sle.warehouse, sle.batch_no, sle.item_code)
 		.having(Sum(sle.actual_qty) > 0)
 		.orderby(IfNull(batch.expiry_date, "2200-01-01"), batch.creation, sle.batch_no, sle.warehouse)
+		.limit(cint(required_qty + total_picked_qty))
 	)
 
 	if from_warehouses:
@@ -530,53 +647,58 @@
 
 
 def get_available_item_locations_for_serial_and_batched_item(
-	item_code, from_warehouses, required_qty, company
+	item_code, from_warehouses, required_qty, company, total_picked_qty=0
 ):
 	# Get batch nos by FIFO
 	locations = get_available_item_locations_for_batched_item(
 		item_code, from_warehouses, required_qty, company
 	)
 
-	filters = frappe._dict(
-		{"item_code": item_code, "company": company, "warehouse": ["!=", ""], "batch_no": ""}
-	)
+	if locations:
+		sn = frappe.qb.DocType("Serial No")
+		conditions = (sn.item_code == item_code) & (sn.company == company)
 
-	# Get Serial Nos by FIFO for Batch No
-	for location in locations:
-		filters.batch_no = location.batch_no
-		filters.warehouse = location.warehouse
-		location.qty = (
-			required_qty if location.qty > required_qty else location.qty
-		)  # if extra qty in batch
+		for location in locations:
+			location.qty = (
+				required_qty if location.qty > required_qty else location.qty
+			)  # if extra qty in batch
 
-		serial_nos = frappe.get_list(
-			"Serial No", fields=["name"], filters=filters, limit=location.qty, order_by="purchase_date"
-		)
+			serial_nos = (
+				frappe.qb.from_(sn)
+				.select(sn.name)
+				.where(
+					(conditions) & (sn.batch_no == location.batch_no) & (sn.warehouse == location.warehouse)
+				)
+				.orderby(sn.purchase_date)
+				.limit(cint(location.qty + total_picked_qty))
+			).run(as_dict=True)
 
-		serial_nos = [sn.name for sn in serial_nos]
-		location.serial_no = serial_nos
+			serial_nos = [sn.name for sn in serial_nos]
+			location.serial_no = serial_nos
+			location.qty = len(serial_nos)
 
 	return locations
 
 
-def get_available_item_locations_for_other_item(item_code, from_warehouses, required_qty, company):
-	# gets all items available in different warehouses
-	warehouses = [x.get("name") for x in frappe.get_list("Warehouse", {"company": company}, "name")]
-
-	filters = frappe._dict(
-		{"item_code": item_code, "warehouse": ["in", warehouses], "actual_qty": [">", 0]}
+def get_available_item_locations_for_other_item(
+	item_code, from_warehouses, required_qty, company, total_picked_qty=0
+):
+	bin = frappe.qb.DocType("Bin")
+	query = (
+		frappe.qb.from_(bin)
+		.select(bin.warehouse, bin.actual_qty.as_("qty"))
+		.where((bin.item_code == item_code) & (bin.actual_qty > 0))
+		.orderby(bin.creation)
+		.limit(cint(required_qty + total_picked_qty))
 	)
 
 	if from_warehouses:
-		filters.warehouse = ["in", from_warehouses]
+		query = query.where(bin.warehouse.isin(from_warehouses))
+	else:
+		wh = frappe.qb.DocType("Warehouse")
+		query = query.from_(wh).where((bin.warehouse == wh.name) & (wh.company == company))
 
-	item_locations = frappe.get_all(
-		"Bin",
-		fields=["warehouse", "actual_qty as qty"],
-		filters=filters,
-		limit=required_qty,
-		order_by="creation",
-	)
+	item_locations = query.run(as_dict=True)
 
 	return item_locations
 
diff --git a/erpnext/stock/doctype/pick_list/pick_list_list.js b/erpnext/stock/doctype/pick_list/pick_list_list.js
new file mode 100644
index 0000000..ad88b0a
--- /dev/null
+++ b/erpnext/stock/doctype/pick_list/pick_list_list.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.listview_settings['Pick List'] = {
+	get_indicator: function (doc) {
+		const status_colors = {
+			"Draft": "grey",
+			"Open": "orange",
+			"Completed": "green",
+			"Cancelled": "red",
+		};
+		return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
+	},
+};
\ No newline at end of file
diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py
index 43acdf0..1254fe3 100644
--- a/erpnext/stock/doctype/pick_list/test_pick_list.py
+++ b/erpnext/stock/doctype/pick_list/test_pick_list.py
@@ -414,6 +414,7 @@
 		pick_list.submit()
 
 		delivery_note = create_delivery_note(pick_list.name)
+		pick_list.load_from_db()
 
 		self.assertEqual(pick_list.locations[0].qty, delivery_note.items[0].qty)
 		self.assertEqual(pick_list.locations[1].qty, delivery_note.items[1].qty)
@@ -663,3 +664,147 @@
 		self.assertEqual(dn.items[0].rate, 42)
 		so.reload()
 		self.assertEqual(so.per_delivered, 100)
+
+	def test_pick_list_status(self):
+		warehouse = "_Test Warehouse - _TC"
+		item = make_item(properties={"maintain_stock": 1}).name
+		make_stock_entry(item=item, to_warehouse=warehouse, qty=10)
+
+		so = make_sales_order(item_code=item, qty=10, rate=100)
+
+		pl = create_pick_list(so.name)
+		pl.save()
+		pl.reload()
+		self.assertEqual(pl.status, "Draft")
+
+		pl.submit()
+		pl.reload()
+		self.assertEqual(pl.status, "Open")
+
+		dn = create_delivery_note(pl.name)
+		dn.save()
+		pl.reload()
+		self.assertEqual(pl.status, "Open")
+
+		dn.submit()
+		pl.reload()
+		self.assertEqual(pl.status, "Completed")
+
+		dn.cancel()
+		pl.reload()
+		self.assertEqual(pl.status, "Completed")
+
+		pl.cancel()
+		pl.reload()
+		self.assertEqual(pl.status, "Cancelled")
+
+	def test_consider_existing_pick_list(self):
+		def create_items(items_properties):
+			items = []
+
+			for properties in items_properties:
+				properties.update({"maintain_stock": 1})
+				item_code = make_item(properties=properties).name
+				properties.update({"item_code": item_code})
+				items.append(properties)
+
+			return items
+
+		def create_stock_entries(items):
+			warehouses = ["Stores - _TC", "Finished Goods - _TC"]
+
+			for item in items:
+				for warehouse in warehouses:
+					se = make_stock_entry(
+						item=item.get("item_code"),
+						to_warehouse=warehouse,
+						qty=5,
+					)
+
+		def get_item_list(items, qty, warehouse="All Warehouses - _TC"):
+			return [
+				{
+					"item_code": item.get("item_code"),
+					"qty": qty,
+					"warehouse": warehouse,
+				}
+				for item in items
+			]
+
+		def get_picked_items_details(pick_list_doc):
+			items_data = {}
+
+			for location in pick_list_doc.locations:
+				key = (location.warehouse, location.batch_no) if location.batch_no else location.warehouse
+				serial_no = [x for x in location.serial_no.split("\n") if x] if location.serial_no else None
+				data = {"picked_qty": location.picked_qty}
+				if serial_no:
+					data["serial_no"] = serial_no
+				if location.item_code not in items_data:
+					items_data[location.item_code] = {key: data}
+				else:
+					items_data[location.item_code][key] = data
+
+			return items_data
+
+		# Step - 1: Setup - Create Items and Stock Entries
+		items_properties = [
+			{
+				"valuation_rate": 100,
+			},
+			{
+				"valuation_rate": 200,
+				"has_batch_no": 1,
+				"create_new_batch": 1,
+			},
+			{
+				"valuation_rate": 300,
+				"has_serial_no": 1,
+				"serial_no_series": "SNO.###",
+			},
+			{
+				"valuation_rate": 400,
+				"has_batch_no": 1,
+				"create_new_batch": 1,
+				"has_serial_no": 1,
+				"serial_no_series": "SNO.###",
+			},
+		]
+
+		items = create_items(items_properties)
+		create_stock_entries(items)
+
+		# Step - 2: Create Sales Order [1]
+		so1 = make_sales_order(item_list=get_item_list(items, qty=6))
+
+		# Step - 3: Create and Submit Pick List [1] for Sales Order [1]
+		pl1 = create_pick_list(so1.name)
+		pl1.submit()
+
+		# Step - 4: Create Sales Order [2] with same Item(s) as Sales Order [1]
+		so2 = make_sales_order(item_list=get_item_list(items, qty=4))
+
+		# Step - 5: Create Pick List [2] for Sales Order [2]
+		pl2 = create_pick_list(so2.name)
+		pl2.save()
+
+		# Step - 6: Assert
+		picked_items_details = get_picked_items_details(pl1)
+
+		for location in pl2.locations:
+			key = (location.warehouse, location.batch_no) if location.batch_no else location.warehouse
+			item_data = picked_items_details.get(location.item_code, {}).get(key, {})
+			picked_qty = item_data.get("picked_qty", 0)
+			picked_serial_no = picked_items_details.get("serial_no", [])
+			bin_actual_qty = frappe.db.get_value(
+				"Bin", {"item_code": location.item_code, "warehouse": location.warehouse}, "actual_qty"
+			)
+
+			# Available Qty to pick should be equal to [Actual Qty - Picked Qty]
+			self.assertEqual(location.stock_qty, bin_actual_qty - picked_qty)
+
+			# Serial No should not be in the Picked Serial No list
+			if location.serial_no:
+				a = set(picked_serial_no)
+				b = set([x for x in location.serial_no.split("\n") if x])
+				self.assertSetEqual(b, b.difference(a))
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 9321c2c..2a9f091 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -221,7 +221,7 @@
 def item_query(doctype, txt, searchfield, start, page_len, filters):
 	from frappe.desk.reportview import get_match_cond
 
-	from_doctype = cstr(filters.get("doctype"))
+	from_doctype = cstr(filters.get("from"))
 	if not from_doctype or not frappe.db.exists("DocType", from_doctype):
 		return []
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 1755f28..8c20ca0 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -158,6 +158,7 @@
 		self.validate_subcontract_order()
 		self.update_subcontract_order_supplied_items()
 		self.update_subcontracting_order_status()
+		self.update_pick_list_status()
 
 		self.make_gl_entries()
 
@@ -2276,6 +2277,11 @@
 
 			update_subcontracting_order_status(self.subcontracting_order)
 
+	def update_pick_list_status(self):
+		from erpnext.stock.doctype.pick_list.pick_list import update_pick_list_status
+
+		update_pick_list_status(self.pick_list)
+
 	def set_missing_values(self):
 		"Updates rate and availability of all the items of mapped doc."
 		self.set_transfer_qty()
diff --git a/erpnext/translations/zh.csv b/erpnext/translations/zh.csv
index 173320d..2337bcb 100644
--- a/erpnext/translations/zh.csv
+++ b/erpnext/translations/zh.csv
@@ -3537,7 +3537,6 @@
 Rules for applying different promotional schemes.,适用不同促销计划的规则。,
 Shift,转移,
 Show {0},显示{0},
-"Special Characters except '-', '#', '.', '/', '{{' and '}}' not allowed in naming series {0}",命名系列中不允许使用除&quot;-&quot;, &quot;#&quot;, &quot;।&quot;, &quot;/&quot;, &quot;{{&quot; 和 &quot;}}&quot;之外的特殊字符 {0},
 Target Details,目标细节,
 {0} already has a Parent Procedure {1}.,{0}已有父程序{1}。,
 API,应用程序界面,
diff --git a/erpnext/translations/zh_tw.csv b/erpnext/translations/zh_tw.csv
index 313908f..1b7e186 100644
--- a/erpnext/translations/zh_tw.csv
+++ b/erpnext/translations/zh_tw.csv
@@ -3311,7 +3311,6 @@
 Rules for applying different promotional schemes.,適用不同促銷計劃的規則。,
 Shift,轉移,
 Show {0},顯示{0},
-"Special Characters except '-', '#', '.', '/', '{{' and '}}' not allowed in naming series {0}",命名系列中不允許使用除 &quot;-&quot;, &quot;#&quot;, &quot;।&quot;, &quot;/&quot;, &quot;{{&quot; 和 &quot;}}&quot;之外的特殊字符 {0},
 Target Details,目標細節,
 API,API,
 Annual,年刊,