Merge branch 'develop' into form-builder-fixes-2

This commit is contained in:
Shariq Ansari 2023-01-20 11:52:15 +05:30 committed by GitHub
commit cba7c638ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 10 deletions

View file

@ -366,8 +366,10 @@ class DocType(Document):
d.fieldname = d.fieldname + "_column"
elif d.fieldtype == "Tab Break":
d.fieldname = d.fieldname + "_tab"
else:
elif d.fieldtype in ("Section Break", "Column Break", "Tab Break"):
d.fieldname = d.fieldtype.lower().replace(" ", "_") + "_" + str(random_string(4))
else:
frappe.throw(_("Row #{}: Fieldname is required").format(d.idx), title="Missing Fieldname")
else:
if d.fieldname in restricted:
frappe.throw(_("Fieldname {0} is restricted").format(d.fieldname), InvalidFieldNameError)
@ -1133,7 +1135,7 @@ def validate_fields(meta):
d.options = options
def check_hidden_and_mandatory(docname, d):
if d.hidden and d.reqd and not d.default:
if d.hidden and d.reqd and not d.default and not frappe.flags.in_migrate:
frappe.throw(
_("{0}: Field {1} in row {2} cannot be hidden and mandatory without default").format(
docname, d.label, d.idx

View file

@ -329,7 +329,11 @@ class File(Document):
self.file_url = duplicate_file.file_url
def set_file_name(self):
if not self.file_name and self.file_url:
if not self.file_name and not self.file_url:
frappe.throw(
_("Fields `file_name` or `file_url` must be set for File"), exc=frappe.MandatoryError
)
elif not self.file_name and self.file_url:
self.file_name = self.file_url.split("/")[-1]
else:
self.file_name = re.sub(r"/", "", self.file_name)

View file

@ -57,6 +57,10 @@ frappe.ui.form.on("Installed Applications", {
});
dialog.fields_dict.apps.grid.refresh();
// hack: change checkboxes to drag handles.
let grid = $(dialog.fields_dict.apps.grid.parent);
grid.find(".grid-row-check:first").remove() &&
grid.find(".grid-row-check").replaceWith(frappe.utils.icon("menu"));
dialog.show();
});
},

View file

@ -1,6 +1,6 @@
{
"actions": [],
"autoname": "PATCHLOG.#####",
"autoname": "hash",
"creation": "2013-01-17 11:36:45",
"description": "List of patches executed",
"doctype": "DocType",
@ -20,11 +20,11 @@
"icon": "fa fa-cog",
"idx": 1,
"links": [],
"modified": "2022-06-13 05:34:37.845368",
"modified": "2023-01-17 15:35:11.688615",
"modified_by": "Administrator",
"module": "Core",
"name": "Patch Log",
"naming_rule": "Expression (old style)",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [
{

View file

@ -112,9 +112,14 @@ $.extend(frappe.model, {
{ fieldname: "name", fieldtype: "Link", label: __("ID") },
{ fieldname: "owner", fieldtype: "Link", label: __("Created By"), options: "User" },
{ fieldname: "idx", fieldtype: "Int", label: __("Index") },
{ fieldname: "creation", fieldtype: "Date", label: __("Created On") },
{ fieldname: "modified", fieldtype: "Date", label: __("Last Updated On") },
{ fieldname: "modified_by", fieldtype: "Data", label: __("Last Updated By") },
{ fieldname: "creation", fieldtype: "Datetime", label: __("Created On") },
{ fieldname: "modified", fieldtype: "Datetime", label: __("Last Updated On") },
{
fieldname: "modified_by",
fieldtype: "Link",
label: __("Last Updated By"),
options: "User",
},
{ fieldname: "_user_tags", fieldtype: "Data", label: __("Tags") },
{ fieldname: "_liked_by", fieldtype: "Data", label: __("Liked By") },
{ fieldname: "_comments", fieldtype: "Text", label: __("Comments") },

View file

@ -39,13 +39,16 @@ frappe.ui.Filter = class {
this.invalid_condition_map = {
Date: ["like", "not like"],
Datetime: ["like", "not like"],
Datetime: ["like", "not like", "in", "not in", "=", "!="],
Data: ["Between", "Timespan"],
Select: ["like", "not like", "Between", "Timespan"],
Link: ["Between", "Timespan", ">", "<", ">=", "<="],
Currency: ["Between", "Timespan"],
Color: ["Between", "Timespan"],
Check: this.conditions.map((c) => c[0]).filter((c) => c !== "="),
Code: ["Between", "Timespan", ">", "<", ">=", "<=", "in", "not in"],
Password: ["Between", "Timespan", ">", "<", ">=", "<=", "in", "not in"],
Rating: ["like", "not like", "Between", "in", "not in", "Timespan"],
};
}
@ -497,10 +500,14 @@ frappe.ui.filter_utils = {
"Small Text",
"Text Editor",
"Code",
"Attach",
"Attach Image",
"Markdown Editor",
"HTML Editor",
"Tag",
"Phone",
"Comments",
"Barcode",
"Dynamic Link",
"Read Only",
"Assign",