[cleanup] projects
This commit is contained in:
parent
8497784c4c
commit
cb144bfcd4
@ -239,7 +239,7 @@ class LeaveApplication(Document):
|
||||
|
||||
def notify(self, args):
|
||||
args = frappe._dict(args)
|
||||
from frappe.desk.page.messages.messages import post
|
||||
from frappe.desk.page.chat.chat import post
|
||||
post(**{"txt": args.message, "contact": args.message_to, "subject": args.subject,
|
||||
"notify": cint(self.follow_via_email)})
|
||||
|
||||
|
@ -11,6 +11,57 @@ frappe.ui.form.on("Project", {
|
||||
"project_name": frm.doc.name
|
||||
}
|
||||
}
|
||||
|
||||
frm.set_query('customer', 'erpnext.controllers.queries.customer_query');
|
||||
|
||||
// sales order
|
||||
frm.set_query('sales_order', function() {
|
||||
var filters = {
|
||||
'project': ["in", frm.doc.__islocal ? [""] : [frm.doc.name, ""]]
|
||||
};
|
||||
|
||||
if (frm.doc.customer) {
|
||||
filters["customer"] = frm.doc.customer;
|
||||
}
|
||||
|
||||
return {
|
||||
filters: filters
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if(frm.doc.__islocal) {
|
||||
frm.web_link && frm.web_link.remove();
|
||||
} else {
|
||||
frm.add_web_link("/projects?project=" + encodeURIComponent(frm.doc.name));
|
||||
|
||||
if(frappe.model.can_read("Task")) {
|
||||
frm.add_custom_button(__("Gantt Chart"), function() {
|
||||
frappe.route_options = {"project": frm.doc.name,
|
||||
"start": frm.doc.expected_start_date, "end": frm.doc.expected_end_date};
|
||||
frappe.set_route("Gantt", "Task");
|
||||
}, __("View"), true);
|
||||
frm.add_custom_button(__("Tasks"), function() {
|
||||
frappe.route_options = {"project": frm.doc.name}
|
||||
frappe.set_route("List", "Task");
|
||||
}, __("View"), true);
|
||||
}
|
||||
|
||||
if(frappe.model.can_read("Time Log")) {
|
||||
frm.add_custom_button(__("Time Logs"), function() {
|
||||
frappe.route_options = {"project": frm.doc.name}
|
||||
frappe.set_route("List", "Time Log");
|
||||
}, __("View"), true);
|
||||
}
|
||||
|
||||
if(frappe.model.can_read("Expense Claim")) {
|
||||
frm.add_custom_button(__("Expense Claims"), function() {
|
||||
frappe.route_options = {"project": frm.doc.name}
|
||||
frappe.set_route("List", "Expense Claim");
|
||||
}, __("View"), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -23,51 +74,3 @@ frappe.ui.form.on("Project Task", "edit_task", function(frm, doctype, name) {
|
||||
}
|
||||
})
|
||||
|
||||
// show tasks
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
if(!doc.__islocal) {
|
||||
if(frappe.model.can_read("Task")) {
|
||||
cur_frm.add_custom_button(__("Gantt Chart"), function() {
|
||||
frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date};
|
||||
frappe.set_route("Gantt", "Task");
|
||||
}, __("View"), true);
|
||||
cur_frm.add_custom_button(__("Tasks"), function() {
|
||||
frappe.route_options = {"project": doc.name}
|
||||
frappe.set_route("List", "Task");
|
||||
}, __("View"), true);
|
||||
}
|
||||
if(frappe.model.can_read("Time Log")) {
|
||||
cur_frm.add_custom_button(__("Time Logs"), function() {
|
||||
frappe.route_options = {"project": doc.name}
|
||||
frappe.set_route("List", "Time Log");
|
||||
}, __("View"), true);
|
||||
}
|
||||
|
||||
if(frappe.model.can_read("Expense Claim")) {
|
||||
cur_frm.add_custom_button(__("Expense Claims"), function() {
|
||||
frappe.route_options = {"project": doc.name}
|
||||
frappe.set_route("List", "Expense Claim");
|
||||
}, __("View"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query: "erpnext.controllers.queries.customer_query"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['sales_order'].get_query = function(doc) {
|
||||
var filters = {
|
||||
'project': ["in", doc.__islocal ? [""] : [doc.name, ""]]
|
||||
};
|
||||
|
||||
if (doc.customer) {
|
||||
filters["customer"] = doc.customer;
|
||||
}
|
||||
|
||||
return {
|
||||
filters: filters
|
||||
}
|
||||
}
|
||||
|
@ -352,6 +352,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"description": "Project will be accessible on the website to these users",
|
||||
"fieldname": "users",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@ -965,14 +966,14 @@
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-puzzle-piece",
|
||||
"idx": 1,
|
||||
"idx": 24,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 4,
|
||||
"modified": "2016-03-25 06:46:29.485193",
|
||||
"modified": "2016-03-31 01:34:05.703925",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Project",
|
||||
|
@ -37,7 +37,7 @@ class Project(Document):
|
||||
self.sync_tasks()
|
||||
self.tasks = []
|
||||
self.send_welcome_email()
|
||||
|
||||
|
||||
def validate_dates(self):
|
||||
if self.expected_start_date and self.expected_end_date:
|
||||
if getdate(self.expected_end_date) < getdate(self.expected_start_date):
|
||||
@ -124,7 +124,7 @@ class Project(Document):
|
||||
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
|
||||
|
||||
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
|
||||
|
||||
|
||||
def send_welcome_email(self):
|
||||
url = get_url("/project/{0}".format(self.name))
|
||||
messages = (
|
||||
@ -143,7 +143,7 @@ class Project(Document):
|
||||
print user.welcome_email_sent
|
||||
frappe.sendmail(user.user, subject=_("Project Collaboration Invitation"), content=content.format(*messages), bulk=True)
|
||||
user.welcome_email_sent=1
|
||||
|
||||
|
||||
|
||||
def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
|
||||
return frappe.db.sql('''select distinct project.*
|
||||
@ -163,7 +163,7 @@ def get_list_context(context=None):
|
||||
return {
|
||||
"title": _("My Projects"),
|
||||
"get_list": get_project_list,
|
||||
"row_template": "templates/includes/project_row.html"
|
||||
"row_template": "templates/includes/projects/project_row.html"
|
||||
}
|
||||
|
||||
@frappe.whitelist()
|
||||
|
@ -3,13 +3,13 @@
|
||||
<a class="no-decoration" href="/projects?project={{ doc.name }}">
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
|
||||
|
||||
{{ doc.name }}
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
{% if doc.percent_complete %}
|
||||
<div class="progress" style="margin-bottom: 0!important; margin-top: 10px!important; height:5px;">
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar"
|
||||
<div class="progress-bar progress-bar-{{ "warning" if doc.percent_complete|round < 100 else "success"}}" role="progressbar"
|
||||
aria-valuenow="{{ doc.percent_complete|round|int }}"
|
||||
aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
|
||||
</div>
|
@ -1,17 +0,0 @@
|
||||
{% for timeline in doc.timelines %}
|
||||
<article class="timeline-entry">
|
||||
<div class="timeline-entry-inner">
|
||||
<div class="timeline-icon {{ "bg-danger" if ((timeline.reference_name).startswith('ISS') and (timeline.subject).startswith('Open')) else "bg-warning" if ((timeline.reference_name).startswith('TASK') and (timeline.subject).startswith('Open')) else "bg-success" if (timeline.subject).startswith('Closed') else "bg-info"}}">
|
||||
</div>
|
||||
<div class="timeline-label">
|
||||
<span class="avatar avatar-small" title="{{ timeline.modified_by }}"> <img src="{{ timeline.user_image }}"></span>
|
||||
<span class='indicator'>
|
||||
{{timeline.reference_name}} {{timeline.subject }}
|
||||
</span>
|
||||
<span class='indicator pull-right'>
|
||||
{{ frappe.utils.pretty_date(timeline.creation) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
@ -38,7 +38,7 @@
|
||||
<div class="col-xs-6">
|
||||
{% if doc.percent_complete %}
|
||||
<div class="progress progress-hg">
|
||||
<div class="progress-bar progress-bar-warning active" role="progressbar"
|
||||
<div class="progress-bar progress-bar-{{ "warning" if doc.percent_complete|round < 100 else "success" }} active" role="progressbar"
|
||||
aria-valuenow="{{ doc.percent_complete|round|int }}"
|
||||
aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user