feat: Set is_system_generated as false if customization is created via Customize Form

This commit is contained in:
Suraj Shetty 2022-03-01 09:20:47 +05:30
parent 54fe7d7ea0
commit c51a581e2c
4 changed files with 7 additions and 6 deletions

View file

@ -1250,7 +1250,7 @@ def get_newargs(fn, kwargs):
return newargs
def make_property_setter(args, ignore_validate=False, validate_fields_for_doctype=True):
def make_property_setter(args, ignore_validate=False, validate_fields_for_doctype=True, is_system_generated=True):
"""Create a new **Property Setter** (for overriding DocType and DocField properties).
If doctype is not specified, it will create a property setter for all fields with the
@ -1281,6 +1281,7 @@ def make_property_setter(args, ignore_validate=False, validate_fields_for_doctyp
'property': args.property,
'value': args.value,
'property_type': args.property_type or "Data",
'is_system_generated': is_system_generated,
'__islocal': 1
})
ps.flags.ignore_validate = ignore_validate

View file

@ -119,7 +119,7 @@ def create_custom_field_if_values_exist(doctype, df):
frappe.db.count(dt=doctype, filters=IfNull(df.fieldname, "") != ""):
create_custom_field(doctype, df)
def create_custom_field(doctype, df, ignore_validate=False):
def create_custom_field(doctype, df, ignore_validate=False, is_system_generated=True):
df = frappe._dict(df)
if not df.fieldname and df.label:
df.fieldname = frappe.scrub(df.label)
@ -130,8 +130,7 @@ def create_custom_field(doctype, df, ignore_validate=False):
"permlevel": 0,
"fieldtype": 'Data',
"hidden": 0,
# Looks like we always use this programatically?
# "is_standard": 1
"is_system_generated": is_system_generated
})
custom_field.update(df)
custom_field.flags.ignore_validate = ignore_validate

View file

@ -243,7 +243,8 @@ frappe.ui.form.on("Customize Form Field", {
},
fields_add: function(frm, cdt, cdn) {
var f = frappe.model.get_doc(cdt, cdn);
f.is_custom_field = 1;
f.is_system_generated = false;
f.is_custom_field = true;
}
});

View file

@ -402,7 +402,7 @@ class CustomizeForm(Document):
"property": prop,
"value": value,
"property_type": property_type
})
}, is_system_generated=False)
def get_existing_property_value(self, property_name, fieldname=None):
# check if there is any need to make property setter!