brotherton-erpnext/erpnext/patches/v9_0/set_pos_profile_name.py
Faris Ansari 4994d84565 fix(pos-profile): Cleanup Form for POS Profile (#16208)
- Remove pos_profile_name field and use `name` as Prompt
- Reorganize form and label sections
- Remove `apply_discount` which was not used
2018-12-14 14:19:14 +05:30

25 lines
686 B
Python

# 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, filters={'disabled': 0}):
doc = frappe.get_doc(doctype, pos.name)
if not doc.user: continue
try:
pos_profile_name = doc.user + ' - ' + doc.company
doc.flags.ignore_validate = True
doc.flags.ignore_mandatory = True
doc.save()
frappe.rename_doc(doctype, doc.name, pos_profile_name, force=True)
except frappe.LinkValidationError:
frappe.db.set_value("POS Profile", doc.name, 'disabled', 1)