patch for renaming the pos profile and setting the pos profile name

This commit is contained in:
Manas Solanki 2017-11-02 16:04:16 +05:30
parent b1616a0cb3
commit 40ef7e7039
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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)