Merge pull request #36888 from ruthra-kumar/gain_loss_refactor_issue_01_patch_failed

fix: calcuate received/paid amount on exchange rate change in Payment Entry
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index ca8b9f0..162e5b5 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -393,6 +393,7 @@
 			pi.remarks,
 			pi.base_net_total,
 			pi.base_grand_total,
+			pi.base_rounded_total,
 			pi.outstanding_amount,
 			pi.mode_of_payment,
 		)
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index d3fc373..0ba7186 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -38,7 +38,7 @@
 	if filters.get("include_payments"):
 		invoice_list += get_payments(filters)
 
-	columns, income_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
+	columns, income_accounts, unrealized_profit_loss_accounts, tax_accounts = get_columns(
 		invoice_list, additional_table_columns, include_payments
 	)
 
diff --git a/erpnext/assets/doctype/location/location.json b/erpnext/assets/doctype/location/location.json
index f56fd05..9202fb9 100644
--- a/erpnext/assets/doctype/location/location.json
+++ b/erpnext/assets/doctype/location/location.json
@@ -39,6 +39,7 @@
   {
    "fieldname": "parent_location",
    "fieldtype": "Link",
+   "ignore_user_permissions": 1,
    "label": "Parent Location",
    "options": "Location",
    "search_index": 1
@@ -141,11 +142,11 @@
  ],
  "is_tree": 1,
  "links": [],
- "modified": "2020-05-08 16:11:11.375701",
+ "modified": "2023-08-29 12:49:33.290527",
  "modified_by": "Administrator",
  "module": "Assets",
  "name": "Location",
- "name_case": "Title Case",
+ "naming_rule": "By fieldname",
  "nsm_parent_field": "parent_location",
  "owner": "Administrator",
  "permissions": [
@@ -224,5 +225,6 @@
  "show_name_in_global_search": 1,
  "sort_field": "modified",
  "sort_order": "DESC",
+ "states": [],
  "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index c8cf7bc..a25c7c2 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -263,7 +263,6 @@
 erpnext.patches.v15_0.delete_saudi_doctypes
 erpnext.patches.v14_0.show_loan_management_deprecation_warning
 execute:frappe.rename_doc("Report", "TDS Payable Monthly", "Tax Withholding Details", force=True)
-erpnext.patches.v14_0.delete_education_module_portal_menu_items
 
 [post_model_sync]
 execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
diff --git a/erpnext/patches/v14_0/delete_education_module_portal_menu_items.py b/erpnext/patches/v14_0/delete_education_module_portal_menu_items.py
deleted file mode 100644
index d964f14..0000000
--- a/erpnext/patches/v14_0/delete_education_module_portal_menu_items.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
-# License: MIT. See LICENSE
-
-import frappe
-
-
-def execute():
-	doctypes = frappe.get_all("DocType", {"module": "education", "custom": 0}, pluck="name")
-	items = frappe.get_all(
-		"Portal Menu Item", filters={"reference_doctype": ("in", doctypes)}, pluck="name"
-	)
-	for item in items:
-		frappe.delete_doc("Portal Menu Item", item, ignore_missing=True, force=True)
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.json b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.json
index 176669f..fd5a595 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.json
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.json
@@ -23,6 +23,7 @@
   {
    "fieldname": "parent_quality_procedure",
    "fieldtype": "Link",
+   "ignore_user_permissions": 1,
    "label": "Parent Procedure",
    "options": "Quality Procedure"
   },
diff --git a/erpnext/setup/doctype/department/department.json b/erpnext/setup/doctype/department/department.json
index 5a16bae..99deca5 100644
--- a/erpnext/setup/doctype/department/department.json
+++ b/erpnext/setup/doctype/department/department.json
@@ -25,18 +25,15 @@
    "label": "Department",
    "oldfieldname": "department_name",
    "oldfieldtype": "Data",
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "fieldname": "parent_department",
    "fieldtype": "Link",
+   "ignore_user_permissions": 1,
    "in_list_view": 1,
    "label": "Parent Department",
-   "options": "Department",
-   "show_days": 1,
-   "show_seconds": 1
+   "options": "Department"
   },
   {
    "fieldname": "company",
@@ -44,9 +41,7 @@
    "in_standard_filter": 1,
    "label": "Company",
    "options": "Company",
-   "reqd": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "reqd": 1
   },
   {
    "bold": 1,
@@ -54,17 +49,13 @@
    "fieldname": "is_group",
    "fieldtype": "Check",
    "in_list_view": 1,
-   "label": "Is Group",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Is Group"
   },
   {
    "default": "0",
    "fieldname": "disabled",
    "fieldtype": "Check",
-   "label": "Disabled",
-   "show_days": 1,
-   "show_seconds": 1
+   "label": "Disabled"
   },
   {
    "fieldname": "lft",
@@ -72,9 +63,7 @@
    "hidden": 1,
    "label": "lft",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "rgt",
@@ -82,9 +71,7 @@
    "hidden": 1,
    "label": "rgt",
    "print_hide": 1,
-   "read_only": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "read_only": 1
   },
   {
    "fieldname": "old_parent",
@@ -92,22 +79,18 @@
    "hidden": 1,
    "ignore_user_permissions": 1,
    "label": "Old Parent",
-   "print_hide": 1,
-   "show_days": 1,
-   "show_seconds": 1
+   "print_hide": 1
   },
   {
    "fieldname": "column_break_3",
-   "fieldtype": "Column Break",
-   "show_days": 1,
-   "show_seconds": 1
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-sitemap",
  "idx": 1,
  "is_tree": 1,
  "links": [],
- "modified": "2020-06-10 12:28:00.563272",
+ "modified": "2023-08-28 17:26:46.826501",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Department",
@@ -147,12 +130,12 @@
    "read": 1,
    "report": 1,
    "role": "HR Manager",
-   "set_user_permissions": 1,
    "share": 1,
    "write": 1
   }
  ],
  "show_name_in_global_search": 1,
  "sort_field": "modified",
- "sort_order": "ASC"
+ "sort_order": "ASC",
+ "states": []
 }
\ No newline at end of file