[project] added patch

This commit is contained in:
Rushabh Mehta 2013-06-07 14:52:53 +05:30
parent 9dd9bb0adf
commit cdd265d3bf
4 changed files with 30 additions and 4 deletions

View File

@ -0,0 +1,5 @@
import webnotes
def execute():
for p in webnotes.conn.sql_list("""select name from tabProject"""):
webnotes.bean("Project", p).controller.update_percent_complete()

View File

@ -258,4 +258,5 @@ patch_list = [
"patches.may_2013.p07_move_update_stock_to_pos",
"patches.may_2013.p08_change_item_wise_tax",
"patches.june_2013.p01_update_bom_exploded_items",
"patches.june_2013.p02_update_project_completed",
]

View File

@ -63,8 +63,9 @@ class DocType:
def update_percent_complete(self):
total = webnotes.conn.sql("""select count(*) from tabTask where project=%s""",
self.doc.name)[0][0]
completed = webnotes.conn.sql("""select count(*) from tabTask where
project=%s and status='Closed'""", self.doc.name)[0][0]
webnotes.conn.set_value("Project", self.doc.name, "percent_complete",
int(float(completed) / total * 100))
if total:
completed = webnotes.conn.sql("""select count(*) from tabTask where
project=%s and status='Closed'""", self.doc.name)[0][0]
webnotes.conn.set_value("Project", self.doc.name, "percent_complete",
int(float(completed) / total * 100))

View File

@ -0,0 +1,19 @@
wn.views.calendar["Task"] = {
field_map: {
"start": "exp_start_date",
"end": "exp_end_date",
"id": "name",
"title": "subject",
"allDay": "allDay"
},
gantt: true,
filters: [
{
"fieldtype": "Link",
"fieldname": "project",
"options": "Project",
"label": "Project"
}
],
get_events_method: "projects.doctype.task.task.get_events"
}