From 80fee65ed2cacc07461a4c19ad46fc2005371a35 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 26 Mar 2013 21:34:38 +0530 Subject: [PATCH] [patch] [fix] material rename --- patches/february_2013/p03_material_request.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py index 612c1084a3..1a9a433ffe 100644 --- a/patches/february_2013/p03_material_request.py +++ b/patches/february_2013/p03_material_request.py @@ -3,8 +3,11 @@ import webnotes, os, sys def execute(): webnotes.reload_doc("core", "doctype", "doctype") - webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True) - webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True) + tables = webnotes.conn.sql_list("sthow tables") + if not "Material Request Item" in tables: + webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True) + if not "Material Request" in tables: + webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True) webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill") webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive")