From 05b56d0d08c73777dbfaff8186ea64ead68431c3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 7 Aug 2014 15:03:25 +0530 Subject: [PATCH] Fix account's master type --- erpnext/patches.txt | 1 + erpnext/patches/v4_2/fix_account_master_type.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 erpnext/patches/v4_2/fix_account_master_type.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7fc858dee73..1ae0a952a76 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -73,3 +73,4 @@ execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool Detail") execute:frappe.delete_doc("Page", "trial-balance") #2014-07-22 erpnext.patches.v4_2.delete_old_print_formats #2014-07-29 erpnext.patches.v4_2.toggle_rounded_total #2014-07-30 +erpnext.patches.v4_2.fix_account_master_type diff --git a/erpnext/patches/v4_2/fix_account_master_type.py b/erpnext/patches/v4_2/fix_account_master_type.py new file mode 100644 index 00000000000..09fa7891d09 --- /dev/null +++ b/erpnext/patches/v4_2/fix_account_master_type.py @@ -0,0 +1,12 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + for d in frappe.db.sql("""select name from `tabAccount` + where ifnull(master_type, '') not in ('Customer', 'Supplier', 'Employee', '')"""): + ac = frappe.get_doc("Account", d[0]) + ac.master_type = None + ac.save()