[fix] execute update_time_and_costing and update_project only for distinct task and projects
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 8d339b9..3d94b5c 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -156,14 +156,18 @@
(self.production_order, operation_id), as_dict=1)[0]
def update_task_and_project(self):
+ tasks, projects = [], []
+
for data in self.time_logs:
- if data.task:
+ if data.task and data.task not in tasks:
task = frappe.get_doc("Task", data.task)
task.update_time_and_costing()
task.save()
+ tasks.append(data.task)
- elif data.project:
+ elif data.project and data.project not in projects:
frappe.get_doc("Project", data.project).update_project()
+ projects.append(data.project)
def validate_dates(self):
for data in self.time_logs: