Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 42508f7..362d8aa 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '9.2.6'
+__version__ = '9.2.7'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 486cd7c..220250b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -456,3 +456,4 @@
erpnext.patches.v9_0.set_uoms_in_variant_field
erpnext.patches.v9_0.copy_old_fees_field_data
erpnext.patches.v9_0.set_pos_profile_name
+erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings
\ No newline at end of file
diff --git a/erpnext/patches/v9_0/copy_old_fees_field_data.py b/erpnext/patches/v9_0/copy_old_fees_field_data.py
index fb11ee5..4243c5b 100644
--- a/erpnext/patches/v9_0/copy_old_fees_field_data.py
+++ b/erpnext/patches/v9_0/copy_old_fees_field_data.py
@@ -5,6 +5,8 @@
import frappe
def execute():
+ frappe.reload_doc("schools", "doctype", "fees")
+
if "total_amount" not in frappe.db.get_table_columns("Fees"):
return
diff --git a/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py b/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py
new file mode 100644
index 0000000..33dc519
--- /dev/null
+++ b/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py
@@ -0,0 +1,7 @@
+import frappe
+
+def execute():
+ default_warehouse = frappe.db.get_value("Stock Settings", None, "default_warehouse")
+ if default_warehouse:
+ if not frappe.db.get_value("Warehouse", {"name": default_warehouse}):
+ frappe.db.set_value("Stock Settings", None, "default_warehouse", "")
\ No newline at end of file
diff --git a/erpnext/patches/v9_0/set_pos_profile_name.py b/erpnext/patches/v9_0/set_pos_profile_name.py
index bc6e50e..3ae3774 100644
--- a/erpnext/patches/v9_0/set_pos_profile_name.py
+++ b/erpnext/patches/v9_0/set_pos_profile_name.py
@@ -8,12 +8,17 @@
doctype = 'POS Profile'
frappe.reload_doctype(doctype)
- for pos in frappe.get_all(doctype):
+ for pos in frappe.get_all(doctype, filters={'disabled': 0}):
doc = frappe.get_doc(doctype, pos.name)
- if not doc.user: continue
+ if not doc.user and doc.pos_profile_name: continue
- doc.pos_profile_name = doc.user + ' - ' + doc.company
- doc.save()
+ try:
+ doc.pos_profile_name = doc.user + ' - ' + doc.company
+ doc.flags.ignore_validate = True
+ doc.flags.ignore_mandatory = True
+ doc.save()
- frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
\ No newline at end of file
+ frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
+ except frappe.LinkValidationError:
+ frappe.db.set_value("POS Profile", doc.name, 'disabled', 1)