Merge pull request #11486 from saurabh6790/patch_fixes_

[fix] catch link validation exception in POS profile and reload fees …
This commit is contained in:
Saurabh 2017-11-08 14:48:33 +05:30 committed by GitHub
commit 148b62a206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -5,6 +5,8 @@ from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("schools", "doctype", "fees")
if "total_amount" not in frappe.db.get_table_columns("Fees"):
return

View File

@ -8,12 +8,17 @@ def execute():
doctype = 'POS Profile'
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)
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.flags.ignore_validate = True
doc.flags.ignore_mandatory = True
doc.save()
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)