[fix] catch link validation exception in POS profile and reload fees doctype
This commit is contained in:
parent
4c617d6496
commit
d2cef208fe
@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
frappe.reload_doc("schools", "doctype", "fees")
|
||||||
|
|
||||||
if "total_amount" not in frappe.db.get_table_columns("Fees"):
|
if "total_amount" not in frappe.db.get_table_columns("Fees"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -8,12 +8,17 @@ def execute():
|
|||||||
doctype = 'POS Profile'
|
doctype = 'POS Profile'
|
||||||
frappe.reload_doctype(doctype)
|
frappe.reload_doctype(doctype)
|
||||||
|
|
||||||
for pos in frappe.get_all(doctype):
|
for pos in frappe.get_all(doctype, filters={'disabled': 0}):
|
||||||
doc = frappe.get_doc(doctype, pos.name)
|
doc = frappe.get_doc(doctype, pos.name)
|
||||||
|
|
||||||
if not doc.user: continue
|
if not doc.user and doc.pos_profile_name: continue
|
||||||
|
|
||||||
|
try:
|
||||||
doc.pos_profile_name = doc.user + ' - ' + doc.company
|
doc.pos_profile_name = doc.user + ' - ' + doc.company
|
||||||
|
doc.flags.ignore_validate = True
|
||||||
|
doc.flags.ignore_mandatory = True
|
||||||
doc.save()
|
doc.save()
|
||||||
|
|
||||||
frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
|
frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
|
||||||
|
except frappe.LinkValidationError:
|
||||||
|
frappe.db.set_value("POS Profile", doc.name, 'disabled', 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user