From 40ef7e70392237d7d3e4d50669cb020f100588a0 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Thu, 2 Nov 2017 16:04:16 +0530 Subject: [PATCH] patch for renaming the pos profile and setting the pos profile name --- erpnext/patches.txt | 1 + erpnext/patches/v9_0/set_pos_profile_name.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 erpnext/patches/v9_0/set_pos_profile_name.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fd7a1b4da6..486cd7cbed 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -455,3 +455,4 @@ erpnext.patches.v9_0.add_healthcare_domain erpnext.patches.v9_0.set_variant_item_description erpnext.patches.v9_0.set_uoms_in_variant_field erpnext.patches.v9_0.copy_old_fees_field_data +erpnext.patches.v9_0.set_pos_profile_name diff --git a/erpnext/patches/v9_0/set_pos_profile_name.py b/erpnext/patches/v9_0/set_pos_profile_name.py new file mode 100644 index 0000000000..bc6e50e6b3 --- /dev/null +++ b/erpnext/patches/v9_0/set_pos_profile_name.py @@ -0,0 +1,19 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + doctype = 'POS Profile' + frappe.reload_doctype(doctype) + + for pos in frappe.get_all(doctype): + doc = frappe.get_doc(doctype, pos.name) + + if not doc.user: continue + + doc.pos_profile_name = doc.user + ' - ' + doc.company + doc.save() + + frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True) \ No newline at end of file