Update project completion percentage and costing after syncing task
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index 0ba368d..6ebafdb 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -46,6 +46,8 @@
 		"""sync tasks and remove table"""
 		if self.flags.dont_sync_tasks: return
 
+
+		task_added_or_deleted = False
 		task_names = []
 		for t in self.tasks:
 			if t.task_id:
@@ -53,6 +55,7 @@
 			else:
 				task = frappe.new_doc("Task")
 				task.project = self.name
+				task_added_or_deleted = True
 
 			task.update({
 				"subject": t.title,
@@ -70,15 +73,22 @@
 		# delete
 		for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}):
 			frappe.delete_doc("Task", t.name)
+			task_added_or_deleted = True
+			
+		if task_added_or_deleted:
+			self.update_project()
+
+	def update_project(self):
+		self.update_percent_complete()
+		self.update_costing()
 
 	def update_percent_complete(self):
-		total = frappe.db.sql("""select count(*) from tabTask where project=%s""",
-			self.name)[0][0]
+		total = frappe.db.sql("""select count(*) from tabTask where project=%s""", self.name)[0][0]
 		if total:
 			completed = frappe.db.sql("""select count(*) from tabTask where
 				project=%s and status in ('Closed', 'Cancelled')""", self.name)[0][0]
-			frappe.db.set_value("Project", self.name, "percent_complete",
-			 	int(float(completed) / total * 100))
+				
+			self.percent_complete = flt(completed) / total * 100
 
 	def update_costing(self):
 		total_cost = frappe.db.sql("""select sum(total_costing_amount) as costing_amount,
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index f5541cc..7229203 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -43,15 +43,8 @@
 	def on_update(self):
 		self.check_recursion()
 		self.reschedule_dependent_tasks()
-		self.update_percentage()
 		self.update_project()
 
-	def update_percentage(self):
-		"""update percent complete in project"""
-		if self.project and not self.flags.from_project:
-			project = frappe.get_doc("Project", self.project)
-			project.run_method("update_percent_complete")
-
 	def update_total_expense_claim(self):
 		self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim`
 			where project = %s and task = %s and approval_status = "Approved" and docstatus=1""",(self.project, self.name))
@@ -70,10 +63,10 @@
 		self.act_end_date= tl.end_date
 
 	def update_project(self):
-		if self.project and frappe.db.exists("Project", self.project):
+		if self.project and not self.flags.from_project:
 			project = frappe.get_doc("Project", self.project)
 			project.flags.dont_sync_tasks = True
-			project.update_costing()
+			project.update_project()
 			project.save()
 
 	def check_recursion(self):