Merge branch 'develop' into fix/dynamic-filters-dialog-prepopulate
This commit is contained in:
commit
65c3d3e765
10 changed files with 432 additions and 410 deletions
|
|
@ -537,51 +537,52 @@ def get_sidebar_items(allowed_workspaces):
|
|||
from frappe import _
|
||||
from frappe.desk.doctype.workspace_sidebar.workspace_sidebar import auto_generate_sidebar_from_module
|
||||
|
||||
sidebars = frappe.get_all("Workspace Sidebar", fields=["name", "header_icon"])
|
||||
workspace_sidebars = frappe.get_all("Workspace Sidebar", fields=["name", "header_icon"])
|
||||
module_sidebars = auto_generate_sidebar_from_module()
|
||||
sidebars.extend(module_sidebars)
|
||||
workspace_sidebars.extend(module_sidebars)
|
||||
sidebar_items = {}
|
||||
|
||||
for s in sidebars:
|
||||
sidebar_title = s.get("name")
|
||||
for sidebar in workspace_sidebars:
|
||||
sidebar_title = sidebar.get("name")
|
||||
sidebar_doc = None
|
||||
if sidebar_title:
|
||||
w = frappe.get_doc("Workspace Sidebar", sidebar_title)
|
||||
sidebar_doc = frappe.get_doc("Workspace Sidebar", sidebar_title)
|
||||
else:
|
||||
sidebar_title = s.title
|
||||
w = s
|
||||
sidebar_title = sidebar.title
|
||||
sidebar_doc = sidebar
|
||||
if (
|
||||
frappe.session.user == "Administrator"
|
||||
or w.module in w.user.allow_modules
|
||||
or sidebar_doc.module in sidebar_doc.user.allow_modules
|
||||
or sidebar_title == "My Workspaces"
|
||||
):
|
||||
sidebar_items[sidebar_title.lower()] = {
|
||||
"label": sidebar_title,
|
||||
"items": [],
|
||||
"header_icon": s.get("header_icon"),
|
||||
"module": w.module,
|
||||
"app": w.app,
|
||||
"header_icon": sidebar.get("header_icon"),
|
||||
"module": sidebar_doc.module,
|
||||
"app": sidebar_doc.app,
|
||||
}
|
||||
for si in w.items:
|
||||
for item in sidebar_doc.items:
|
||||
workspace_sidebar = {
|
||||
"label": _(si.label),
|
||||
"link_to": si.link_to,
|
||||
"link_type": si.link_type,
|
||||
"type": si.type,
|
||||
"icon": si.icon,
|
||||
"child": si.child,
|
||||
"collapsible": si.collapsible,
|
||||
"indent": si.indent,
|
||||
"keep_closed": si.keep_closed,
|
||||
"display_depends_on": si.display_depends_on,
|
||||
"url": si.url,
|
||||
"show_arrow": si.show_arrow,
|
||||
"filters": si.filters,
|
||||
"route_options": si.route_options,
|
||||
"tab": si.navigate_to_tab,
|
||||
"label": _(item.label),
|
||||
"link_to": item.link_to,
|
||||
"link_type": item.link_type,
|
||||
"type": item.type,
|
||||
"icon": item.icon,
|
||||
"child": item.child,
|
||||
"collapsible": item.collapsible,
|
||||
"indent": item.indent,
|
||||
"keep_closed": item.keep_closed,
|
||||
"display_depends_on": item.display_depends_on,
|
||||
"url": item.url,
|
||||
"show_arrow": item.show_arrow,
|
||||
"filters": item.filters,
|
||||
"route_options": item.route_options,
|
||||
"tab": item.navigate_to_tab,
|
||||
}
|
||||
if si.link_type == "Report" and si.link_to and frappe.db.exists("Report", si.link_to):
|
||||
if item.link_type == "Report" and item.link_to and frappe.db.exists("Report", item.link_to):
|
||||
report_type, ref_doctype = frappe.db.get_value(
|
||||
"Report", si.link_to, ["report_type", "ref_doctype"]
|
||||
"Report", item.link_to, ["report_type", "ref_doctype"]
|
||||
)
|
||||
workspace_sidebar["report"] = {
|
||||
"report_type": report_type,
|
||||
|
|
@ -589,8 +590,8 @@ def get_sidebar_items(allowed_workspaces):
|
|||
}
|
||||
if (
|
||||
"My Workspaces" in sidebar_title
|
||||
or si.type == "Section Break"
|
||||
or w.is_item_allowed(si.link_to, si.link_type, allowed_workspaces)
|
||||
or item.type == "Section Break"
|
||||
or sidebar_doc.is_item_allowed(item.link_to, item.link_type, allowed_workspaces)
|
||||
):
|
||||
sidebar_items[sidebar_title.lower()]["items"].append(workspace_sidebar)
|
||||
add_user_specific_sidebar(sidebar_items)
|
||||
|
|
|
|||
|
|
@ -275,9 +275,11 @@ class Database:
|
|||
frappe.log(f"Syntax error in query:\n{query} {values or ''}")
|
||||
|
||||
elif self.is_deadlocked(e):
|
||||
self.db_type == "mariadb" and frappe.log_error("Query deadlocked", defer_insert=True)
|
||||
raise frappe.QueryDeadlockError(e) from e
|
||||
|
||||
elif self.is_timedout(e):
|
||||
self.db_type == "mariadb" and frappe.log_error("Query timed out", defer_insert=True)
|
||||
raise frappe.QueryTimeoutError(e) from e
|
||||
|
||||
elif self.is_read_only_mode_error(e):
|
||||
|
|
|
|||
|
|
@ -116,12 +116,15 @@ class DesktopIcon(Document):
|
|||
def check_app_permission(self):
|
||||
for a in frappe.get_installed_apps():
|
||||
if frappe.get_hooks(app_name=a)["app_title"][0] == self.label or self.app == a:
|
||||
permission_method = frappe.get_hooks(app_name=a)["add_to_apps_screen"][0].get(
|
||||
"has_permission", None
|
||||
)
|
||||
if permission_method:
|
||||
return frappe.call(permission_method)
|
||||
app_detail = frappe.get_hooks("add_to_apps_screen", app_name=a)
|
||||
if len(app_detail) != 0:
|
||||
permission_method = app_detail[0].get("has_permission", None)
|
||||
if permission_method:
|
||||
return frappe.call(permission_method)
|
||||
else:
|
||||
return True
|
||||
else:
|
||||
# App hooks.py doesn't have add_to_apps_screen
|
||||
return True
|
||||
|
||||
# def is_permitted(self):
|
||||
|
|
|
|||
|
|
@ -296,6 +296,9 @@ class DesktopPage {
|
|||
{
|
||||
label: "Edit Layout",
|
||||
icon: "edit",
|
||||
condition: function () {
|
||||
return !me.edit_mode;
|
||||
},
|
||||
onClick: function () {
|
||||
me.$desktop_edit_button.hide();
|
||||
frappe.new_desktop_icons = JSON.parse(JSON.stringify(frappe.desktop_icons));
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -123,7 +123,6 @@
|
|||
|
||||
.data-row.row {
|
||||
.selected-phone {
|
||||
top: calc(50% - 10.1px);
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class TestCachingUtils(IntegrationTestCase):
|
|||
|
||||
# ensure single call if key is hashable
|
||||
for arg in hashable_values:
|
||||
external_service.call_count = 0
|
||||
external_service.reset_mock()
|
||||
for _ in range(2):
|
||||
request_specific_api(arg, 13)
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class TestCachingUtils(IntegrationTestCase):
|
|||
|
||||
# multiple calls if key cannot be generated
|
||||
for arg in unhashable_values:
|
||||
external_service.call_count = 0
|
||||
external_service.reset_mock()
|
||||
for _ in range(2):
|
||||
request_specific_api(arg, 13)
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,9 @@ def transform_parameter_types(func: Callable, args: tuple, kwargs: dict, force_t
|
|||
func_params = frappe._get_cached_signature_params(func)[0]
|
||||
|
||||
if force_types:
|
||||
for param_name, parameter in func_params.items():
|
||||
for idx, (param_name, parameter) in enumerate(func_params.items()):
|
||||
if idx == 0 and param_name in ("self", "cls"):
|
||||
continue
|
||||
if parameter.kind in (inspect.Parameter.VAR_KEYWORD, inspect.Parameter.VAR_POSITIONAL):
|
||||
continue
|
||||
if param_name not in annotations:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,17 @@
|
|||
{% include "templates/includes/meta_block.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% if hide_navbar %}{% block navbar %}{% endblock %}{% endif %}
|
||||
{% if hide_footer %}{% block footer %}{% endblock %}{% endif %}
|
||||
{% block navbar %}
|
||||
{% if not hide_navbar %}
|
||||
{% include "templates/includes/navbar/navbar.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{% if not hide_footer %}
|
||||
{% include "templates/includes/footer/footer.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ dependencies = [
|
|||
"filetype~=1.2.0",
|
||||
"GitPython~=3.1.45",
|
||||
"Jinja2~=3.1.6",
|
||||
"Pillow~=12.0.0",
|
||||
"Pillow~=12.1.1",
|
||||
"PyJWT~=2.10.1",
|
||||
# We depend on internal attributes,
|
||||
# do NOT add loose requirements on PyMySQL versions.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue