mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 22:48:27 +00:00
Merge pull request #46612 from frappe/mergify/bp/version-15-hotfix/pr-46173
feat(projects): add option to hide timesheets for project users (backport #46173)
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
"full_name",
|
"full_name",
|
||||||
"welcome_email_sent",
|
"welcome_email_sent",
|
||||||
"view_attachments",
|
"view_attachments",
|
||||||
|
"hide_timesheets",
|
||||||
"section_break_5",
|
"section_break_5",
|
||||||
"project_status"
|
"project_status"
|
||||||
],
|
],
|
||||||
@@ -64,6 +65,13 @@
|
|||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "View attachments"
|
"label": "View attachments"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"columns": 2,
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "hide_timesheets",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Hide timesheets"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_5",
|
"fieldname": "section_break_5",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
{{ empty_state(_("Task")) }}
|
{{ empty_state(_("Task")) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h4 class="my-account-header">{{ _("Timesheets") }}</h4>
|
|
||||||
{% if doc.timesheets %}
|
{% if doc.timesheets %}
|
||||||
|
<h4 class="my-account-header">{{ _("Timesheets") }}</h4>
|
||||||
<div class="website-list">
|
<div class="website-list">
|
||||||
<div class="result">
|
<div class="result">
|
||||||
<div class="web-list-item transaction-list-item">
|
<div class="web-list-item transaction-list-item">
|
||||||
@@ -73,8 +73,6 @@
|
|||||||
{% include "erpnext/templates/includes/projects/project_timesheets.html" %}
|
{% include "erpnext/templates/includes/projects/project_timesheets.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
{{ empty_state(_("Timesheet")) }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if doc.attachments %}
|
{% if doc.attachments %}
|
||||||
@@ -136,4 +134,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ def get_context(context):
|
|||||||
project_user = frappe.db.get_value(
|
project_user = frappe.db.get_value(
|
||||||
"Project User",
|
"Project User",
|
||||||
{"parent": frappe.form_dict.project, "user": frappe.session.user},
|
{"parent": frappe.form_dict.project, "user": frappe.session.user},
|
||||||
["user", "view_attachments"],
|
["user", "view_attachments", "hide_timesheets"],
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
if frappe.session.user != "Administrator" and (not project_user or frappe.session.user == "Guest"):
|
if frappe.session.user != "Administrator" and (not project_user or frappe.session.user == "Guest"):
|
||||||
@@ -25,7 +25,8 @@ def get_context(context):
|
|||||||
project.name, start=0, item_status="open", search=frappe.form_dict.get("search")
|
project.name, start=0, item_status="open", search=frappe.form_dict.get("search")
|
||||||
)
|
)
|
||||||
|
|
||||||
project.timesheets = get_timesheets(project.name, start=0, search=frappe.form_dict.get("search"))
|
if project_user and not project_user.hide_timesheets:
|
||||||
|
project.timesheets = get_timesheets(project.name, start=0, search=frappe.form_dict.get("search"))
|
||||||
|
|
||||||
if project_user and project_user.view_attachments:
|
if project_user and project_user.view_attachments:
|
||||||
project.attachments = get_attachments(project.name)
|
project.attachments = get_attachments(project.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user