Merge pull request #37859 from marination/split-invoice-refactor

fix: `split_invoices_based_on_payment_terms`
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 5f0b434..c2e01c4 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -175,13 +175,6 @@
 		if self.payment_url:
 			self.db_set("payment_url", self.payment_url)
 
-		if (
-			self.payment_url
-			or not self.payment_gateway_account
-			or (self.payment_gateway_account and self.payment_channel == "Phone")
-		):
-			self.db_set("status", "Initiated")
-
 	def get_payment_url(self):
 		if self.reference_doctype != "Fees":
 			data = frappe.db.get_value(
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 16e73ea..371474e 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -31,7 +31,12 @@
 from erpnext.exceptions import InvalidAccountCurrency, PartyDisabled, PartyFrozen
 from erpnext.utilities.regional import temporary_flag
 
-PURCHASE_TRANSACTION_TYPES = {"Purchase Order", "Purchase Receipt", "Purchase Invoice"}
+PURCHASE_TRANSACTION_TYPES = {
+	"Supplier Quotation",
+	"Purchase Order",
+	"Purchase Receipt",
+	"Purchase Invoice",
+}
 SALES_TRANSACTION_TYPES = {
 	"Quotation",
 	"Sales 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 06dbd86..fd73f77 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
@@ -9,6 +9,8 @@
  "field_order": [
   "naming_series",
   "company",
+  "billing_address",
+  "billing_address_display",
   "vendor",
   "column_break1",
   "transaction_date",
@@ -292,13 +294,25 @@
    "fieldtype": "Check",
    "label": "Send Document Print",
    "print_hide": 1
+  },
+  {
+   "fieldname": "billing_address",
+   "fieldtype": "Link",
+   "label": "Company Billing Address",
+   "options": "Address"
+  },
+  {
+   "fieldname": "billing_address_display",
+   "fieldtype": "Small Text",
+   "label": "Billing Address Details",
+   "read_only": 1
   }
  ],
  "icon": "fa fa-shopping-cart",
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2023-08-09 12:20:26.850623",
+ "modified": "2023-11-06 12:45:28.898706",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Request for Quotation",
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 7b635b3..ad1aa2b 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -79,6 +79,7 @@
   "pricing_rule_details",
   "pricing_rules",
   "address_and_contact_tab",
+  "supplier_address_section",
   "supplier_address",
   "address_display",
   "column_break_72",
@@ -86,6 +87,14 @@
   "contact_display",
   "contact_mobile",
   "contact_email",
+  "shipping_address_section",
+  "shipping_address",
+  "column_break_zjaq",
+  "shipping_address_display",
+  "company_billing_address_section",
+  "billing_address",
+  "column_break_gcth",
+  "billing_address_display",
   "terms_tab",
   "tc_name",
   "terms",
@@ -838,6 +847,55 @@
    "fieldname": "named_place",
    "fieldtype": "Data",
    "label": "Named Place"
+  },
+  {
+   "fieldname": "shipping_address",
+   "fieldtype": "Link",
+   "label": "Shipping Address",
+   "options": "Address",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "column_break_zjaq",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "shipping_address_display",
+   "fieldtype": "Small Text",
+   "label": "Shipping Address Details",
+   "print_hide": 1,
+   "read_only": 1
+  },
+  {
+   "fieldname": "shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Shipping Address"
+  },
+  {
+   "fieldname": "supplier_address_section",
+   "fieldtype": "Section Break",
+   "label": "Supplier Address"
+  },
+  {
+   "fieldname": "company_billing_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Billing Address"
+  },
+  {
+   "fieldname": "billing_address",
+   "fieldtype": "Link",
+   "label": "Company Billing Address",
+   "options": "Address"
+  },
+  {
+   "fieldname": "column_break_gcth",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "billing_address_display",
+   "fieldtype": "Small Text",
+   "label": "Billing Address Details",
+   "read_only": 1
   }
  ],
  "icon": "fa fa-shopping-cart",
@@ -845,7 +903,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2023-06-03 16:20:15.880114",
+ "modified": "2023-11-03 13:21:40.172508",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Supplier Quotation",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d394db6..0aeadce 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -338,6 +338,7 @@
 erpnext.patches.v14_0.migrate_deferred_accounts_to_item_defaults
 erpnext.patches.v14_0.update_invoicing_period_in_subscription
 execute:frappe.delete_doc("Page", "welcome-to-erpnext")
+erpnext.patches.v15_0.migrate_payment_request_status
 erpnext.patches.v15_0.delete_payment_gateway_doctypes
 erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item
 erpnext.patches.v15_0.update_sre_from_voucher_details
diff --git a/erpnext/patches/v15_0/migrate_payment_request_status.py b/erpnext/patches/v15_0/migrate_payment_request_status.py
new file mode 100644
index 0000000..746a67b
--- /dev/null
+++ b/erpnext/patches/v15_0/migrate_payment_request_status.py
@@ -0,0 +1,15 @@
+import frappe
+
+
+def execute():
+	"""
+	Description:
+	Change Inward Payment Requests from statut 'Initiated' to correct status 'Requested'.
+	Status 'Initiated' is reserved for Outward Payment Requests and was a semantic error in previour versions.
+	"""
+
+	if frappe.reload_doc("accounts", "doctype", "Payment Request"):
+		so = frappe.qb.DocType("Payment Request")
+		frappe.qb.update(so).set(so.status, "Requested").where(
+			so.payment_request_type == "Inward"
+		).where(so.status == "Initiated").run()
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 5c41aa0..cba615c 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -4,7 +4,7 @@
 frappe.provide("erpnext.utils");
 
 const SALES_DOCTYPES = ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'];
-const PURCHASE_DOCTYPES = ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'];
+const PURCHASE_DOCTYPES = ['Supplier Quotation','Purchase Order', 'Purchase Receipt', 'Purchase Invoice'];
 
 erpnext.utils.get_party_details = function(frm, method, args, callback) {
 	if (!method) {
diff --git a/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py b/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
index 5dfc1db..ecb63d8 100644
--- a/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
+++ b/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
@@ -80,7 +80,7 @@
 
 		territory_orders = []
 		if t_quotation_names and sales_orders:
-			list(filter(lambda x: x.quotation in t_quotation_names, sales_orders))
+			territory_orders = list(filter(lambda x: x.quotation in t_quotation_names, sales_orders))
 		t_order_names = []
 		if territory_orders:
 			t_order_names = [t.name for t in territory_orders]
diff --git a/erpnext/stock/doctype/batch/batch.json b/erpnext/stock/doctype/batch/batch.json
index e6cb351..e20030a 100644
--- a/erpnext/stock/doctype/batch/batch.json
+++ b/erpnext/stock/doctype/batch/batch.json
@@ -61,6 +61,7 @@
    "oldfieldname": "item",
    "oldfieldtype": "Link",
    "options": "Item",
+   "read_only_depends_on": "eval:!doc.__islocal",
    "reqd": 1
   },
   {
@@ -207,7 +208,7 @@
  "image_field": "image",
  "links": [],
  "max_attachments": 5,
- "modified": "2023-03-12 15:56:09.516586",
+ "modified": "2023-11-09 12:17:28.339975",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Batch",
@@ -224,7 +225,6 @@
    "read": 1,
    "report": 1,
    "role": "Item Manager",
-   "set_user_permissions": 1,
    "share": 1,
    "write": 1
   }
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index 61e301e..73755be 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -5074,7 +5074,7 @@
 PUR-ORD-.YYYY.-,PUR-ORD-.YYYY.-,
 Get Items from Open Material Requests,Hole Artikel von offenen Material  Anfragen,
 Fetch items based on Default Supplier.,Abrufen von Elementen basierend auf dem Standardlieferanten.,
-Required By,Benötigt von,
+Required By,Benötigt bis,
 Order Confirmation No,Auftragsbestätigung Nr,
 Order Confirmation Date,Auftragsbestätigungsdatum,
 Customer Mobile No,Mobilnummer des Kunden,