[fix] back links from project web view
This commit is contained in:
parent
1058bd0ae0
commit
b2269dd326
@ -5,8 +5,8 @@ frappe.ui.form.on("Warehouse", {
|
||||
refresh: function(frm) {
|
||||
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
||||
|
||||
frm.add_custom_button(__("Stock Ledger"), function() {
|
||||
frappe.set_route("query-report", "Stock Ledger", {"warehouse": frm.doc.name});
|
||||
frm.add_custom_button(__("Stock Balance"), function() {
|
||||
frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name});
|
||||
});
|
||||
if(frm.doc.__onload && frm.doc.__onload.account) {
|
||||
frm.add_custom_button(__("General Ledger"), function() {
|
||||
|
@ -462,6 +462,32 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Project",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Project",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -664,32 +690,6 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Project",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Project",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
@ -702,7 +702,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-03-09 18:31:10.404549",
|
||||
"modified": "2016-03-23 07:40:21.423217",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Issue",
|
||||
@ -713,26 +713,6 @@
|
||||
"apply_user_permissions": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Projects User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
@ -742,8 +722,6 @@
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"restrict": 0,
|
||||
"restricted": 0,
|
||||
"role": "Customer",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
@ -764,8 +742,6 @@
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"restrict": 0,
|
||||
"restricted": 0,
|
||||
"role": "Support Team",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
|
1
erpnext/templates/includes/projects/macros.html
Normal file
1
erpnext/templates/includes/projects/macros.html
Normal file
@ -0,0 +1 @@
|
||||
{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}|{{ doc.project_name }}{% endmacro %}
|
@ -1,8 +1,10 @@
|
||||
{%- from "templates/includes/projects/macros.html" import back_link -%}
|
||||
|
||||
{% for issue in doc.issues %}
|
||||
<div class='issue'>
|
||||
<div class='row project-item'>
|
||||
<div class='col-xs-9'>
|
||||
<a class="no-decoration" href="/issues-view?name={{ issue.name}}">
|
||||
<a class="no-decoration" href="/issues?name={{ issue.name}}{{ back_link(doc) }}">
|
||||
<span class="indicator {{ "red" if issue.status=="Open" else "green" }}">
|
||||
{% if issue.status == "Closed" %}
|
||||
{{ issue.subject }} resolved {{ frappe.utils.pretty_date(issue.resolution_date) }}
|
||||
|
@ -1,8 +1,10 @@
|
||||
{%- from "templates/includes/projects/macros.html" import back_link -%}
|
||||
|
||||
{% for task in doc.tasks %}
|
||||
<div class='task'>
|
||||
<div class='row project-item'>
|
||||
<div class='col-xs-9'>
|
||||
<a class="no-decoration" href="/tasks-view?name={{ task.name}}">
|
||||
<a class="no-decoration" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
|
||||
<span class="indicator {{ "orange" if task.status=="Open" else "green" }}">
|
||||
{% if task.status == "Closed" %}
|
||||
{{ task.subject }} completed on {{ task.closing_date }}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{%- from "templates/includes/projects/macros.html" import back_link -%}
|
||||
|
||||
{% for timelog in doc.timelogs %}
|
||||
<div class='timelog'>
|
||||
<div class='row project-item'>
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
{% block title %}{{ doc.project_name }}{% endblock %}
|
||||
|
||||
{%- from "templates/includes/projects/macros.html" import back_link -%}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="page-breadcrumbs" data-html-block="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
@ -43,13 +45,12 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class='padding'></div>
|
||||
|
||||
<h3>{{ _("Tasks") }}</h3>
|
||||
|
||||
{% if doc.tasks %}
|
||||
<div class='project-tasks-section'>
|
||||
<div>
|
||||
<a class="btn btn-xs btn-primary pull-right"
|
||||
href='/tasks?new=1&project={{ doc.project_name }}'>New</a>
|
||||
<h3>{{ _("Tasks") }}</h3>
|
||||
</div>
|
||||
<div class="btn-group btn-toggle">
|
||||
<button class="btn btn-link btn-open-tasks"><span class="indicator orange"></span>Open</button>
|
||||
<button class="btn btn-link btn-closed-tasks"><span class="indicator green"></span>Closed</button>
|
||||
@ -66,13 +67,13 @@
|
||||
<p class="text-muted">No tasks</p>
|
||||
{% endif %}
|
||||
|
||||
<p><a href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>Add a new task</a></p>
|
||||
|
||||
<div class='padding'></div>
|
||||
<h3>{{ _("Issues") }}</h3>
|
||||
|
||||
{% if doc.issues %}
|
||||
<div class='project-issues-section'>
|
||||
<div>
|
||||
<a class="btn btn-xs btn-primary pull-right"
|
||||
href='/issues?new=1&project={{ doc.project_name }}'>New</a>
|
||||
<h3>{{ _("Issues") }}</h3>
|
||||
</div>
|
||||
<div class="btn-group btn-toggle">
|
||||
<button class="btn btn-link btn-open-issues"><span class="indicator red"></span>Open</button>
|
||||
<button class="btn btn-link btn-closed-issues"><span class="indicator green"></span>Closed</button>
|
||||
@ -89,8 +90,13 @@
|
||||
<p class="text-muted">No Issues</p>
|
||||
{% endif %}
|
||||
|
||||
<p> <a href='/issues?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>Add a new issue</a></p>
|
||||
|
||||
<div class='padding'></div>
|
||||
|
||||
<h3>{{ _("Time Logs") }}</h3>
|
||||
|
||||
{% if doc.timelogs %}
|
||||
<h3>{{ _("Time Logs") }}</h3>
|
||||
<div class='project-timelogs'>
|
||||
{% include "erpnext/templates/includes/projects/project_timelogs.html" %}
|
||||
</div>
|
||||
|
@ -3,8 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
import json
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
@ -30,7 +29,13 @@ def get_context(context):
|
||||
|
||||
|
||||
def get_timeline(project, start=10):
|
||||
issue_names = '({0})'.format(", ".join(["'{0}'".format(i.name) for i in get_issues(project)]))
|
||||
'''Get timeline from project, tasks, issues'''
|
||||
issues_condition = ''
|
||||
project_issues = get_issues(project)
|
||||
|
||||
if project_issues:
|
||||
issue_names = '({0})'.format(", ".join(["'{0}'".format(i.name) for i in project_issues]))
|
||||
issues_condition = """or (reference_doctype='Issue' and reference_name IN {issue_names})""".format(issue_names=issue_names)
|
||||
|
||||
|
||||
timelines = frappe.db.sql("""
|
||||
@ -43,10 +48,10 @@ def get_timeline(project, start=10):
|
||||
where
|
||||
(reference_doctype='Project' and reference_name=%s)
|
||||
or (timeline_doctype='Project' and timeline_name=%s)
|
||||
or (reference_doctype='Issue' and reference_name IN {issue_names})
|
||||
{issues_condition}
|
||||
order by
|
||||
modified DESC limit {start}, {limit}""".format(
|
||||
issue_names=issue_names, start=start, limit=10),
|
||||
issues_condition=issues_condition, start=start, limit=10),
|
||||
(project, project), as_dict=True);
|
||||
for timeline in timelines:
|
||||
timeline.user_image = frappe.db.get_value('User', timeline.modified_by, 'user_image')
|
||||
@ -78,7 +83,7 @@ def get_tasks(project, start=0, search=None, item_status=None):
|
||||
task.todo=task.todo[0]
|
||||
task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
|
||||
if task._comments:
|
||||
task.comment_count = len(json.loads(_comments or "[]"))
|
||||
task.comment_count = len(json.loads(task._comments or "[]"))
|
||||
return tasks
|
||||
|
||||
@frappe.whitelist()
|
||||
@ -141,4 +146,3 @@ def set_issue_status(project, item_name):
|
||||
issue.status = 'Closed'
|
||||
issue.save(ignore_permissions=True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user