Merge branch 'v7.2.0-beta' into develop
This commit is contained in:
commit
3c71cb0c3e
1 changed files with 10 additions and 6 deletions
|
|
@ -9,7 +9,7 @@ import frappe
|
|||
from frappe import _
|
||||
|
||||
from frappe.utils import now, cint
|
||||
from frappe.model import no_value_fields
|
||||
from frappe.model import no_value_fields, default_fields
|
||||
from frappe.model.document import Document
|
||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||
from frappe.desk.notifications import delete_notification_count_for
|
||||
|
|
@ -419,7 +419,6 @@ def validate_fields(meta):
|
|||
if not meta.search_fields:
|
||||
return
|
||||
|
||||
fieldname_list = [d.fieldname for d in fields]
|
||||
for fieldname in (meta.search_fields or "").split(","):
|
||||
fieldname = fieldname.strip()
|
||||
if fieldname not in fieldname_list:
|
||||
|
|
@ -430,8 +429,6 @@ def validate_fields(meta):
|
|||
if not meta.get("title_field"):
|
||||
return
|
||||
|
||||
fieldname_list = [d.fieldname for d in fields]
|
||||
|
||||
if meta.title_field not in fieldname_list:
|
||||
frappe.throw(_("Title field must be a valid fieldname"), InvalidFieldNameError)
|
||||
|
||||
|
|
@ -469,8 +466,6 @@ def validate_fields(meta):
|
|||
if not meta.timeline_field:
|
||||
return
|
||||
|
||||
fieldname_list = [d.fieldname for d in fields]
|
||||
|
||||
if meta.timeline_field not in fieldname_list:
|
||||
frappe.throw(_("Timeline field must be a valid fieldname"), InvalidFieldNameError)
|
||||
|
||||
|
|
@ -478,7 +473,15 @@ def validate_fields(meta):
|
|||
if df.fieldtype not in ("Link", "Dynamic Link"):
|
||||
frappe.throw(_("Timeline field must be a Link or Dynamic Link"), InvalidFieldNameError)
|
||||
|
||||
def check_sort_field(meta):
|
||||
if meta.sort_field:
|
||||
if not meta.sort_field in fieldname_list + list(default_fields):
|
||||
frappe.throw(_("Sort field must be a valid fieldname"), InvalidFieldNameError)
|
||||
|
||||
|
||||
fields = meta.get("fields")
|
||||
fieldname_list = [d.fieldname for d in fields]
|
||||
|
||||
not_allowed_in_list_view = list(copy.copy(no_value_fields))
|
||||
if meta.istable:
|
||||
not_allowed_in_list_view.remove('Button')
|
||||
|
|
@ -502,6 +505,7 @@ def validate_fields(meta):
|
|||
check_search_fields(meta)
|
||||
check_title_field(meta)
|
||||
check_timeline_field(meta)
|
||||
check_sort_field(meta)
|
||||
|
||||
def validate_permissions_for_doctype(doctype, for_remove=False):
|
||||
"""Validates if permissions are set correctly."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue