From d2cef208fe66dfc6727c7f4d79b167c7fd59b7bf Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 8 Nov 2017 13:41:10 +0530 Subject: [PATCH 1/3] [fix] catch link validation exception in POS profile and reload fees doctype --- erpnext/patches/v9_0/copy_old_fees_field_data.py | 2 ++ erpnext/patches/v9_0/set_pos_profile_name.py | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) 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 fb11ee5a56..4243c5bb62 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 @@ from __future__ import unicode_literals 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/set_pos_profile_name.py b/erpnext/patches/v9_0/set_pos_profile_name.py index bc6e50e6b3..3ae3774e3e 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 @@ def execute(): 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) From 045b2877b7c85b6881cc0dea58f5c3873cd016f1 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 8 Nov 2017 14:57:03 +0530 Subject: [PATCH 2/3] [fix] remove warehouse from Stock Settings if warehouse wont exists (#11487) --- erpnext/patches.txt | 1 + .../remove_non_existing_warehouse_from_stock_settings.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 486cd7cbed..220250b131 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -456,3 +456,4 @@ erpnext.patches.v9_0.set_variant_item_description 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/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 0000000000..33dc5192d1 --- /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 From 3894a5ed944a038d66434ee779c0f586f9e9d9b5 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 8 Nov 2017 15:37:33 +0600 Subject: [PATCH 3/3] bumped to version 9.2.7 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 42508f7e89..362d8aa423 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect 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'''