From 874ead2ed9de86eea20c4a67ce7b53cb2766c09e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 4 May 2015 08:53:38 +0530 Subject: [PATCH] Update warehouse as per master_name if master_name exists --- erpnext/patches/v5_0/link_warehouse_with_account.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v5_0/link_warehouse_with_account.py b/erpnext/patches/v5_0/link_warehouse_with_account.py index 87e9b49112..338fd7ad7f 100644 --- a/erpnext/patches/v5_0/link_warehouse_with_account.py +++ b/erpnext/patches/v5_0/link_warehouse_with_account.py @@ -5,5 +5,6 @@ from __future__ import unicode_literals import frappe def execute(): - frappe.db.sql("""update tabAccount set warehouse=master_name - where ifnull(account_type, '') = 'Warehouse' and ifnull(master_name, '') != ''""") \ No newline at end of file + if "master_name" in frappe.db.get_table_columns("Account"): + frappe.db.sql("""update tabAccount set warehouse=master_name + where ifnull(account_type, '') = 'Warehouse' and ifnull(master_name, '') != ''""") \ No newline at end of file