Skip to content

Commit

Permalink
feat: update frappe app till 22 oct
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish committed Oct 23, 2024
1 parent 96ac703 commit cdbd871
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 97 deletions.
2 changes: 1 addition & 1 deletion frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)
from .utils.lazy_loader import lazy_import

__version__ = "15.8.1"
__version__ = "15.45.0"
__title__ = "Frappe Framework"

controllers = {}
Expand Down
1 change: 1 addition & 0 deletions frappe/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def run_tests(
click.secho(f"bench --site {site} set-config allow_tests true", fg="green")
return

frappe.init(site) # init frappe.flags
frappe.flags.skip_before_tests = skip_before_tests
frappe.flags.skip_test_records = skip_test_records

Expand Down
6 changes: 2 additions & 4 deletions frappe/database/mariadb/setup_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ def bootstrap_database(verbose, source_sql=None):

secho(
"Table 'tabDefaultValue' missing in the restored site. "
"Database not installed correctly, this can due to lack of "
"permission, or that the database name exists. Check your mysql"
" root password, validity of the backup file or use --force to"
" reinstall",
"This happens when the backup fails to restore. Please check that the file is valid\n"
"Do go through the above output to check the exact error message from MariaDB",
fg="red",
)
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions frappe/database/postgres/setup_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def bootstrap_database(verbose, source_sql=None):

secho(
"Table 'tabDefaultValue' missing in the restored site. "
"This may be due to incorrect permissions or the result of a restore from a bad backup file. "
"Database not installed correctly.",
"This happens when the backup fails to restore. Please check that the file is valid\n"
"Do go through the above output to check the exact error message from MariaDB",
fg="red",
)
sys.exit(1)
Expand Down
176 changes: 92 additions & 84 deletions frappe/desk/doctype/list_view_settings/list_view_settings.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,93 @@
{
"actions": [],
"autoname": "Prompt",
"creation": "2019-10-23 15:00:48.392374",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"disable_count",
"disable_comment_count",
"disable_sidebar_stats",
"disable_auto_refresh",
"total_fields",
"fields_html",
"fields"
],
"fields": [
{
"default": "0",
"fieldname": "disable_count",
"fieldtype": "Check",
"label": "Disable Count"
},
{
"default": "0",
"fieldname": "disable_sidebar_stats",
"fieldtype": "Check",
"label": "Disable Sidebar Stats"
},
{
"default": "0",
"fieldname": "disable_auto_refresh",
"fieldtype": "Check",
"label": "Disable Auto Refresh"
},
{
"fieldname": "total_fields",
"fieldtype": "Select",
"label": "Maximum Number of Fields",
"options": "\n4\n5\n6\n7\n8\n9\n10"
},
{
"fieldname": "fields_html",
"fieldtype": "HTML",
"label": "Fields"
},
{
"fieldname": "fields",
"fieldtype": "Code",
"hidden": 1,
"label": "Fields",
"read_only": 1
},
{
"default": "0",
"fieldname": "disable_comment_count",
"fieldtype": "Check",
"label": "Disable Comment Count"
}
],
"links": [],
"modified": "2023-02-14 14:46:43.764229",
"modified_by": "Administrator",
"module": "Desk",
"name": "List View Settings",
"naming_rule": "Set by user",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"read_only": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
"actions": [],
"autoname": "Prompt",
"creation": "2019-10-23 15:00:48.392374",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"disable_count",
"disable_comment_count",
"disable_sidebar_stats",
"disable_auto_refresh",
"allow_edit",
"total_fields",
"fields_html",
"fields"
],
"fields": [
{
"default": "0",
"fieldname": "disable_count",
"fieldtype": "Check",
"label": "Disable Count"
},
{
"default": "0",
"fieldname": "disable_sidebar_stats",
"fieldtype": "Check",
"label": "Disable Sidebar Stats"
},
{
"default": "0",
"fieldname": "disable_auto_refresh",
"fieldtype": "Check",
"label": "Disable Auto Refresh"
},
{
"fieldname": "total_fields",
"fieldtype": "Select",
"label": "Maximum Number of Fields",
"options": "\n4\n5\n6\n7\n8\n9\n10"
},
{
"fieldname": "fields_html",
"fieldtype": "HTML",
"label": "Fields"
},
{
"fieldname": "fields",
"fieldtype": "Code",
"hidden": 1,
"label": "Fields",
"read_only": 1
},
{
"default": "0",
"fieldname": "disable_comment_count",
"fieldtype": "Check",
"label": "Disable Comment Count"
},
{
"default": "0",
"description": "Allow editing even if the doctype has a workflow set up.\n\nDoes nothing if a workflow isn't set up.",
"fieldname": "allow_edit",
"fieldtype": "Check",
"label": "Allow Bulk Editing"
}
],
"links": [],
"modified": "2024-08-21 18:17:24.889783",
"modified_by": "Administrator",
"module": "Desk",
"name": "List View Settings",
"naming_rule": "Set by user",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"read_only": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
3 changes: 2 additions & 1 deletion frappe/desk/doctype/list_view_settings/list_view_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ListViewSettings(Document):
if TYPE_CHECKING:
from frappe.types import DF

allow_edit: DF.Check
disable_auto_refresh: DF.Check
disable_comment_count: DF.Check
disable_count: DF.Check
Expand Down Expand Up @@ -96,4 +97,4 @@ def get_default_listview_fields(doctype):
if meta.title_field.strip() not in fields:
fields.append(meta.title_field.strip())

return fields
return fields
4 changes: 2 additions & 2 deletions frappe/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def check_user_permission_on_link_fields(d):
# get the list of all allowed values for this link
allowed_docs = get_allowed_docs_for_doctype(user_permissions.get(field.options, []), doctype)

if allowed_docs and d.get(field.fieldname) not in allowed_docs:
if allowed_docs and str(d.get(field.fieldname)) not in allowed_docs:
# restricted for this link field, and no matching values found
# make the right message and exit
if d.get("parentfield"):
Expand Down Expand Up @@ -832,4 +832,4 @@ def has_child_permission(


def is_system_user(user: str | None = None) -> bool:
return frappe.get_cached_value("User", user or frappe.session.user, "user_type") == "System User"
return frappe.get_cached_value("User", user or frappe.session.user, "user_type") == "System User"
10 changes: 9 additions & 1 deletion frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,14 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
return frappe.perm.has_perm(doctype, 0, "submit");
};

const is_bulk_edit_allowed = (doctype) => {
// Check settings if there is a workflow defined, otherwise directly allow
if (frappe.model.has_workflow(doctype)) {
return !!this.list_view_settings?.allow_edit;
}
return true;
};

// utility
const bulk_assignment = () => {
return {
Expand Down Expand Up @@ -2034,7 +2042,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
};

// bulk edit
if (has_editable_fields(doctype) && !frappe.model.has_workflow(doctype)) {
if (has_editable_fields(doctype) && is_bulk_edit_allowed(doctype)) {
actions_menu_items.push(bulk_edit());
}

Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/frappe/utils/number_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function get_currency_symbol(currency) {
function get_number_format(currency) {
let sysdefaults = frappe?.boot?.sysdefaults;
return (
(sysdefaults.use_number_format_from_currency &&
(cint(sysdefaults?.use_number_format_from_currency) &&
currency &&
frappe.model.get_value(":Currency", currency, "number_format")) ||
sysdefaults.number_format ||
Expand Down
3 changes: 2 additions & 1 deletion frappe/utils/print_format.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import http
import json
import os
Expand Down Expand Up @@ -279,4 +280,4 @@ def print_by_server(
):
frappe.throw(_("PDF generation failed"))
except cups.IPPError:
frappe.throw(_("Printing failed"))
frappe.throw(_("Printing failed"))

0 comments on commit cdbd871

Please sign in to comment.