Merge pull request #38766 from ruthra-kumar/7101_only_treat_none

fix: validation error on reconciling PE to Journals as Invoice
diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
index ba946c3..d045d91 100644
--- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
+++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
@@ -345,21 +345,16 @@
 
 	if filters.get("party"):
 		party = [filters.get("party")]
-		query = query.where(
-			((gle.account.isin(tds_accounts) & gle.against.isin(party)))
-			| ((gle.voucher_type == "Journal Entry") & (gle.party == filters.get("party")))
-			| gle.party.isin(party)
+		jv_condition = gle.against.isin(party) | (
+			(gle.voucher_type == "Journal Entry") & (gle.party == filters.get("party"))
 		)
 	else:
 		party = frappe.get_all(filters.get("party_type"), pluck="name")
-		query = query.where(
-			((gle.account.isin(tds_accounts) & gle.against.isin(party)))
-			| (
-				(gle.voucher_type == "Journal Entry")
-				& ((gle.party_type == filters.get("party_type")) | (gle.party_type == ""))
-			)
-			| gle.party.isin(party)
+		jv_condition = gle.against.isin(party) | (
+			(gle.voucher_type == "Journal Entry")
+			& ((gle.party_type == filters.get("party_type")) | (gle.party_type == ""))
 		)
+	query = query.where((gle.account.isin(tds_accounts) & jv_condition) | gle.party.isin(party))
 	return query
 
 
diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json
index dafbd9f..92f446d 100644
--- a/erpnext/crm/doctype/lead/lead.json
+++ b/erpnext/crm/doctype/lead/lead.json
@@ -516,7 +516,7 @@
  "idx": 5,
  "image_field": "image",
  "links": [],
- "modified": "2023-08-28 22:28:00.104413",
+ "modified": "2023-12-01 18:46:49.468526",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "Lead",
@@ -577,6 +577,7 @@
  ],
  "search_fields": "lead_name,lead_owner,status",
  "sender_field": "email_id",
+ "sender_name_field": "lead_name",
  "show_name_in_global_search": 1,
  "sort_field": "modified",
  "sort_order": "DESC",
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index ef6cfb0..f3c7e57 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -16,6 +16,7 @@
 from erpnext.accounts.party import set_taxes
 from erpnext.controllers.selling_controller import SellingController
 from erpnext.crm.utils import CRMNote, copy_comments, link_communications, link_open_events
+from erpnext.selling.doctype.customer.customer import parse_full_name
 
 
 class Lead(SellingController, CRMNote):
@@ -113,6 +114,10 @@
 					return
 			self.contact_doc = self.create_contact()
 
+		# leads created by email inbox only have the full name set
+		if self.lead_name and not any([self.first_name, self.middle_name, self.last_name]):
+			self.first_name, self.middle_name, self.last_name = parse_full_name(self.lead_name)
+
 	def after_insert(self):
 		self.link_to_contact()
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 0de100a..9b070bd 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -351,5 +351,6 @@
 erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation
 erpnext.patches.v14_0.update_zero_asset_quantity_field
 execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency", "Each Transaction")
+execute:frappe.db.set_default("date_format", frappe.db.get_single_value("System Settings", "date_format"))
 # below migration patch should always run last
 erpnext.patches.v14_0.migrate_gl_to_payment_ledger
diff --git a/erpnext/portal/doctype/homepage/homepage.js b/erpnext/portal/doctype/homepage/homepage.js
index 6797904..6739979 100644
--- a/erpnext/portal/doctype/homepage/homepage.js
+++ b/erpnext/portal/doctype/homepage/homepage.js
@@ -2,14 +2,6 @@
 // For license information, please see license.txt
 
 frappe.ui.form.on('Homepage', {
-	setup: function(frm) {
-		frm.fields_dict["products"].grid.get_field("item").get_query = function() {
-			return {
-				filters: {'published': 1}
-			}
-		}
-	},
-
 	refresh: function(frm) {
 		frm.add_custom_button(__('Set Meta Tags'), () => {
 			frappe.utils.set_meta_tag('home');
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index d1214fd..7a1d5e2 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -85,8 +85,6 @@
 			except frappe.ValidationError:
 				pass
 
-	frappe.db.set_default("date_format", "dd-mm-yyyy")
-
 	setup_currency_exchange()
 
 
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 9673a70..d90b71a 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -199,9 +199,8 @@
 
 	get_item_data: function(frm, item, overwrite_warehouse=false) {
 		if (item && !item.item_code) { return; }
-		frm.call({
+		frappe.call({
 			method: "erpnext.stock.get_item_details.get_item_details",
-			child: item,
 			args: {
 				args: {
 					item_code: item.item_code,
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
index 08e0432..b9b435c 100644
--- a/erpnext/templates/pages/home.html
+++ b/erpnext/templates/pages/home.html
@@ -26,6 +26,26 @@
 		{{ render_homepage_section(homepage.hero_section_doc) }}
 	{% endif %}
 
+	{% if homepage.products %}
+	<section class="container section-products my-5">
+		<h3>{{ _('Products') }}</h3>
+
+		<div class="row">
+			{% for item in homepage.products %}
+			<div class="col-md-4 mb-4">
+				<div class="card h-100 justify-content-between">
+					<img class="card-img-top website-image-extra-large" src="{{ item.image }}" loading="lazy" alt="{{ item.item_name }}"></img>
+					<div class="card-body flex-grow-0">
+						<h5 class="card-title">{{ item.item_name }}</h5>
+						<a href="{{ item.route }}" class="card-link">{{ _('More details') }}</a>
+					</div>
+				</div>
+			</div>
+			{% endfor %}
+		</div>
+	</section>
+	{% endif %}
+
 	{% if blogs %}
 	<section class="container my-5">
 		<h3>{{ _('Publications') }}</h3>