From c81621d3ce50c521181ecead131db96ee936d76d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 19 Jan 2017 14:32:36 +0530 Subject: [PATCH] [minor] add progress bar in patch --- erpnext/patches/v7_2/contact_address_links.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v7_2/contact_address_links.py b/erpnext/patches/v7_2/contact_address_links.py index be256f2d833..db724b0f4ee 100644 --- a/erpnext/patches/v7_2/contact_address_links.py +++ b/erpnext/patches/v7_2/contact_address_links.py @@ -1,5 +1,6 @@ import frappe from frappe.core.doctype.dynamic_link.dynamic_link import deduplicate_dynamic_links +from frappe.utils import update_progress_bar def execute(): frappe.reload_doc('core', 'doctype', 'dynamic_link') @@ -13,9 +14,9 @@ def execute(): ) for doctype in ('Contact', 'Address'): if frappe.db.has_column(doctype, 'customer'): - for doc in frappe.get_all(doctype, fields='*'): - doc.doctype = doctype - doc = frappe.get_doc(doc) + items = frappe.get_all(doctype) + for i, doc in enumerate(items): + doc = frappe.get_doc(doctype, doc.name) dirty = False for field in map_fields: if doc.get(field[1]): @@ -25,3 +26,6 @@ def execute(): if dirty: deduplicate_dynamic_links(doc) doc.update_children() + + update_progress_bar('Updating {0}'.format(doctype), i, len(items)) + print \ No newline at end of file