mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
feat: calculate hours (#33464)
* feat: calculate hours * chore: Linting Issues Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
This commit is contained in:
@@ -25,12 +25,18 @@ class Timesheet(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.set_status()
|
self.set_status()
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
|
self.calculate_hours()
|
||||||
self.validate_time_logs()
|
self.validate_time_logs()
|
||||||
self.update_cost()
|
self.update_cost()
|
||||||
self.calculate_total_amounts()
|
self.calculate_total_amounts()
|
||||||
self.calculate_percentage_billed()
|
self.calculate_percentage_billed()
|
||||||
self.set_dates()
|
self.set_dates()
|
||||||
|
|
||||||
|
def calculate_hours(self):
|
||||||
|
for row in self.time_logs:
|
||||||
|
if row.to_time and row.from_time:
|
||||||
|
row.hours = time_diff_in_hours(row.to_time, row.from_time)
|
||||||
|
|
||||||
def calculate_total_amounts(self):
|
def calculate_total_amounts(self):
|
||||||
self.total_hours = 0.0
|
self.total_hours = 0.0
|
||||||
self.total_billable_hours = 0.0
|
self.total_billable_hours = 0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user