From 781ddc3a25224eb81b7525bcb18254693c2a75f7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 22 Jul 2014 16:11:18 +0530 Subject: [PATCH] added patch to remove old print formats --- erpnext/patches.txt | 1 + erpnext/patches/v4_2/__init__.py | 0 .../patches/v4_2/delete_old_print_formats.py | 23 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 erpnext/patches/v4_2/__init__.py create mode 100644 erpnext/patches/v4_2/delete_old_print_formats.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 5c64213ccb..676e0d186a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -72,3 +72,4 @@ execute:frappe.db.sql("update `tabAccount` set root_type='Liability' where root_ execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool") 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 diff --git a/erpnext/patches/v4_2/__init__.py b/erpnext/patches/v4_2/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/patches/v4_2/delete_old_print_formats.py b/erpnext/patches/v4_2/delete_old_print_formats.py new file mode 100644 index 0000000000..1456f95131 --- /dev/null +++ b/erpnext/patches/v4_2/delete_old_print_formats.py @@ -0,0 +1,23 @@ +# 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(): + old_formats = ("Sales Invoice", "Sales Invoice Spartan", "Sales Invoice Modern", + "Sales Invoice Classic", + "Sales Order Spartan", "Sales Order Modern", "Sales Order Classic", + "Purchase Order Spartan", "Purchase Order Modern", "Purchase Order Classic", + "Quotation Spartan", "Quotation Modern", "Quotation Classic", + "Delivery Note Spartan", "Delivery Note Modern", "Delivery Note Classic") + + for fmt in old_formats: + # update property setter + for ps in frappe.db.sql_list("""select name from `tabProperty Setter` + where property_type='default_print_format' and value=%s""", fmt): + ps = frappe.get_doc("Property Setter", ps) + ps.value = "Standard" + ps.save(ignore_permissions = True) + + frappe.delete_doc("Print Format", fmt)