Browse Source

Merge pull request #906 from nabinhait/hotfix

Don't validate fields for doctype for custom fields when called from customize form
version-14
Nabin Hait 10 years ago
parent
commit
0bdcd50018
2 changed files with 4 additions and 4 deletions
  1. +2
    -1
      frappe/__init__.py
  2. +2
    -3
      frappe/core/doctype/custom_field/custom_field.py

+ 2
- 1
frappe/__init__.py View File

@@ -530,7 +530,7 @@ def call(fn, *args, **kwargs):
newargs[a] = kwargs.get(a)
return fn(*args, **newargs)

def make_property_setter(args, ignore_validate=False):
def make_property_setter(args, ignore_validate=False, validate_fields_for_doctype=True):
args = _dict(args)
ps = get_doc({
'doctype': "Property Setter",
@@ -543,6 +543,7 @@ def make_property_setter(args, ignore_validate=False):
'__islocal': 1
})
ps.ignore_validate = ignore_validate
ps.validate_fields_for_doctype = validate_fields_for_doctype
ps.insert()

def import_doc(path, ignore_links=False, ignore_insert=False, insert=False):


+ 2
- 3
frappe/core/doctype/custom_field/custom_field.py View File

@@ -31,8 +31,7 @@ class CustomField(Document):

def on_update(self):
frappe.clear_cache(doctype=self.dt)

if not getattr(self, "ignore_validate", None):
if not getattr(self, "ignore_validate", False):
# validate field
from frappe.core.doctype.doctype.doctype import validate_fields_for_doctype
validate_fields_for_doctype(self.dt)
@@ -74,7 +73,7 @@ class CustomField(Document):
"fieldname": self.fieldname,
"property": "previous_field",
"value": self.insert_after
})
}, validate_fields_for_doctype=False)

@frappe.whitelist()
def get_fields_label(doctype=None):


Loading…
Cancel
Save