Bläddra i källkod

Don't validate fields for doctype for custom fields when called from customize form

version-14
Nabin Hait 10 år sedan
förälder
incheckning
91679155a1
2 ändrade filer med 4 tillägg och 4 borttagningar
  1. +2
    -1
      frappe/__init__.py
  2. +2
    -3
      frappe/core/doctype/custom_field/custom_field.py

+ 2
- 1
frappe/__init__.py Visa fil

@@ -530,7 +530,7 @@ def call(fn, *args, **kwargs):
newargs[a] = kwargs.get(a) newargs[a] = kwargs.get(a)
return fn(*args, **newargs) 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) args = _dict(args)
ps = get_doc({ ps = get_doc({
'doctype': "Property Setter", 'doctype': "Property Setter",
@@ -543,6 +543,7 @@ def make_property_setter(args, ignore_validate=False):
'__islocal': 1 '__islocal': 1
}) })
ps.ignore_validate = ignore_validate ps.ignore_validate = ignore_validate
ps.validate_fields_for_doctype = validate_fields_for_doctype
ps.insert() ps.insert()


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


+ 2
- 3
frappe/core/doctype/custom_field/custom_field.py Visa fil

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


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

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


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


Laddar…
Avbryt
Spara